WCF使用SOAP 1.2生成带有SOAP 1.1引用的WSDL。

3

我正在创建一个WCF服务,它必须拥有一个SOAP 1.2端点。该服务正在使用以下自定义绑定:

    <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未正确描述服务,可能存在问题。


你使用的绑定类型是什么?是 basichttpbinding 吗? - Rahul
customBinding,协议soap 1.2在属性'messageVersion'上通过标签textMessageEncoding进行定义。 - Sérgio S. Filho
2个回答

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

必须将websServices放入system.web部分中。否则,解决方案会抛出错误:“配置部分'webServices'无法读取,因为缺少部分声明”。


2

请尝试在web.config(或)app.config文件中进行以下更改:

<Configuration>
    <webServices>
        <protocols>
            <remove name="HttpSOAP"/>
            <add name="HttpSOAP12" />
        </protocols>
    </webServices>
</configuration>

感谢@Rahul,现在soap12的命名空间是显式的: xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"但我仍然对以下行不太清楚: <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/> - Sérgio S. Filho
SOAP 1.1:http://schemas.xmlsoap.org/soap/envelope/ SOAP 1.2:http://www.w3.org/2003/05/soap-envelope http://wso2.com/library/articles/differentiating-between-soap-versions-looking-soap-message/ - Sérgio S. Filho

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接