使用soap 1.2的WCF生成带有soap 1.1引用的wsdl

时间:2014-03-07 15:56:03

标签: web-services wcf soap wsdl

我正在创建一个必须具有soap 1.2端点的WCF服务。该服务使用以下自定义绑定:

    <customBinding>
        <binding name="httpsBinding" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00">
          <transactionFlow />
          <security authenticationMode="UserNameOverTransport" allowInsecureTransport="true" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" >
            <secureConversationBootstrap allowInsecureTransport="true"></secureConversationBootstrap>
          </security>
          <textMessageEncoding messageVersion="Soap12">
            <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                maxBytesPerRead="2147483647"
                maxNameTableCharCount="2147483647" />
          </textMessageEncoding>
          <httpsTransport maxReceivedMessageSize="2147483647"  />
        </binding>
      </customBinding>

直到这里,当通过fiddler调试时,包的格式正确(soap 1.2):

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header>...

但是调查生成的WSDL,绑定似乎是指SOAP 1.1模式。

<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>

WSDL上没有http://www.w3.org/2003/05/soap-envelope的引用。虽然它正在工作,但我认为有一些问题,因为WSDL似乎没有正确地描述服务。

2 个答案:

答案 0 :(得分:2)

尝试在web.config(或)app.config文件

中进行以下更改
<Configuration>
<webServices>
<protocols>
<remove name="HttpSOAP"/>
<add name="HttpSOAP12>
</protocols>
</webServices>
</configuration>

答案 1 :(得分:1)

<Configuration>
 <system.web>
   <webServices>
     <protocols>
        <remove name="HttpSOAP"/>
        <add name="HttpSOAP12"/>
     </protocols>
  </webServices>
</system.web>

websServices需要包含在system.web部分中。如果不是soltuion抛出错误&#34;配置部分&#39; webServices&#39;无法读取,因为它缺少部分声明&#34;