简体   繁体   中英

WCF using soap 1.2 generates wsdl with soap 1.1 reference

I am creating a WCF service which must have a soap 1.2 endpoint. The service is using the following custom binding:

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

All right until here, the packages are in the right format (soap 1.2) when debugged via fiddler:

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

But investigating the WSDL generated, the binding seems to be referring the soap 1.1 schema.

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

There is no reference for http://www.w3.org/2003/05/soap-envelope on the WSDL. Though it's working, I guess there is something wrong since the WSDL seems not to be describing the service correctly.

Try making the below changes in web.config (OR) app.config file

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

websServices needs to be enclosed within the system.web section. If not the soltuion throws error " The configuration section 'webServices' cannot be read because it is missing a section declaration "

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM