3

I'm trying to modify a port name for a web service I made, but I can't figure out what I'm doing wrong.

I found this post that gives an example of how to do it: WSDL-first approach: How to specify different names for wsdl:port and wsdl:binding?

I've made a simple web service for testing the suggested solution in the above post, but the port name is not updated.

Here is a snippet from the wsdl, where two port names are defined. I'd like to modify port name helloSoap12 to something else.

<wsdl:service name="hello">
    <wsdl:port name="helloSoap" binding="tns:helloSoap">
        <soap:address location="http://someaddress/Hello.asmx" /> 
    </wsdl:port>
    <wsdl:port name="helloSoap12" binding="tns:helloSoap12">
        <soap12:address location="http://someaddress/Hello.asmx" /> 
    </wsdl:port>
</wsdl:service>

Here is how the web config looks like:

<configuration>
<system.web>
  <compilation debug="true" targetFramework="4.5" />
  <httpRuntime targetFramework="4.5" />
</system.web>

<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.helloSoap12">
    <endpoint address="" binding="basicHttpBinding" contract="CustomWsdlExtension.helloSoap12"
              behaviorConfiguration="customPortName" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<configuration>

As you might have figured out, I'm new to this and all input is highly appreciated

Community
  • 1
  • 1
  • I'm stuck in something like this too. I have the feeling that understand the deep of WSDL is essential. I'm kind of lose. Here (https://msdn.microsoft.com/en-us/library/ms996486.aspx) is an explanation of WSDL. – Luis.Andrade Oct 19 '16 at 16:28

0 Answers0