修改wsdl端口名称

时间:2015-09-24 09:35:59

标签: c# web-services soap wsdl

我正在尝试修改我所创建的Web服务的端口名称,但我无法弄清楚我做错了什么。

我发现这篇文章提供了如何执行此操作的示例:WSDL-first approach: How to specify different names for wsdl:port and wsdl:binding?

我在上面的帖子中提供了一个简单的Web服务来测试建议的解决方案,但是端口名称没有更新。

这是wsdl的一个片段,其中定义了两个端口名称。我想将端口名称helloSoap12修改为其他内容。

<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>

以下是网络配置的外观:

<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>

正如您可能已经想到的那样,我是新手,并且所有输入都非常受欢迎

0 个答案:

没有答案