Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3722066
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:46:18+00:00 2026-05-19T05:46:18+00:00

I am following WSDL-first (provided by our client) approach for developing WCF service but

  • 0

I am following WSDL-first (provided by our client) approach for developing WCF service but WSDLs generated from my wcf service is slightly different from WSDL provided to me by our client and because of this mismatch, client is facing difficulties to make a call to my service.

Client provided wsdl:

<wsdl:service name='CheckoutService'>
<wsdl:port binding='tns:CheckoutBinding' name='CheckoutServicePort'>
<soap:address location='place holder to service uri' />
</wsdl:port>
</wsdl:service>

WSDL generated from wcf service:


<wsdl:service name="CheckoutService">
<wsdl:port binding="tns:CheckoutBinding" name="CheckoutBinging">
<soap:address location="place holder to service uri" />
</wsdl:port>
</wsdl:service>

and, my service settings are as follows:

<endpoint name="CheckoutBinding" address="" binding="basicHttpBinding" bindingName="CheckoutServicePort" bindingConfiguration="basicHttpBinding" bindingNamespace="<<namespace>>" contract="<<contractname>>" />

I have used WSCF.Blue for generating server-stub code from the client provided wsdl and made minor changes in the generated code to emit WSDL exactly same as the one provided by client but i am not getting any idea about what change to make in the config file or in generated code to get the same “wsdl:port/@name” as in the client provided wsdl file.

As per this url, serviceendpoint name property is mapped to wsdl:port/@name and wsdl:binding/@name. Based on this, endpoint/@name attribute value in my config file is mapped to wsdl:port/@name and wsdl:binding/@name but i want different names to be mapped to wsdl:port/@name and wsdl:binding/@name attributes.

Kindly help me in achieving this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T05:46:19+00:00Added an answer on May 19, 2026 at 5:46 am

    You can try to implement IWsdlExportExtension and in ExportEndpoint modify wsdl:port/@name. Then implement IEndpointBehavior which will add your extension to an endpoint. To use your new behavior you have two choices:

    • Add behavior from code. When service is hosted in IIS you have to create custom ServiceHost and ServiceHostFactory. In self hosting you can just iterate endpoints and add behavior.
    • Add behavior from configuration. You must implement custom BehaviorExtensionElement, register this element and use it in endpointBehaviors related to your endpoint.

    Here is simple example with extension element:

    using System;
    using System.Configuration;
    using System.ServiceModel.Configuration;
    using System.ServiceModel.Description;
    
    namespace CustomWsdlExtension    
    {
        public class PortNameWsdlBehavior : IWsdlExportExtension, IEndpointBehavior
        {
            public string Name { get; set; }
    
            public void ExportContract(WsdlExporter exporter, WsdlContractConversionContext context)
            {
            }
    
            public void ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext context)
            {
                if (!string.IsNullOrEmpty(Name))
                {
                    context.WsdlPort.Name = Name;
                }
            }
    
            public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
            {
            }
    
            public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
            {
            }
    
            public void ApplyDispatchBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher)
            {
            }
    
            public void Validate(ServiceEndpoint endpoint)
            {
            }
        }
    
        public class PortNameWsdlBehaviorExtension : BehaviorExtensionElement
        {
            [ConfigurationProperty("name")]
            public string Name
            {
                get 
                { 
                    object value = this["name"];
                    return value != null ? value.ToString() : string.Empty; 
                }
                set { this["name"] = value; }
            }
    
            public override Type BehaviorType
            {
                get { return typeof(PortNameWsdlBehavior); }
            }
    
            protected override object CreateBehavior()
            {
                return new PortNameWsdlBehavior { Name = Name };
            }
        }
    }
    

    And configuration:

      <system.serviceModel>
        <extensions>
          <behaviorExtensions>
            <add name="portName" type="CustomWsdlExtension.PortNameWsdlBehaviorExtension, CustomWsdlExtension" />
          </behaviorExtensions>
        </extensions>
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
          </serviceBehaviors>
          <endpointBehaviors>
            <behavior name="customPortName">
              <portName name="myCustomName" />
            </behavior>
          </endpointBehaviors>
        </behaviors>
        <services>
          <service name="CustomWsdlExtension.Service">
            <endpoint address="" binding="basicHttpBinding" contract="CustomWsdlExtension.IService"
                      behaviorConfiguration="customPortName" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          </service>
        </services>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
    

    My WSDL then looks like:

    <wsdl:service name="Service">
        <wsdl:port name="myCustomName" binding="tns:BasicHttpBinding_IService">
            <soap:address location="http://localhost:2366/Service.svc" /> 
        </wsdl:port>
    </wsdl:service>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to generate axis2 client stub for given WSDL but getting following
Following on from my recent question on Large, Complex Objects as a Web Service
I am developing a contract-first web service based on Spring-WS. I'm relying on Castor
I'm using Spring's ContextLoaderListener to initialise a web services client, but if the wsdl
I have a WSDL generated by WCF and now this WSDL should be used
I'm using the following lines of code to call the web-service below: def wsdl
Following on from this question what would be the best way to write a
Following techniques from 'Modern C++ Design', I am implementing a persistence library with various
Following on from the question asked by Mykroft Best way to handle input from
Following up from this question: How can I unlock a file that is locked

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.