Search code examples
c#asp.netweb-serviceswcfsoap

WCF is using SOAP 1.2 even though MessageVersion is Soap11WSAddressing10


My issue is the following. I have received a WSDL to implement in my .NET 4.7.1 ASP.NET application so another company can call an operation from that WSDL that we implement. They require a few specific settings for the WCF service.

  • SOAP 1.1
  • WS-Security 1.0
  • WS-Addressing 1.0 (2005-08)
  • HTTPS (With x509 certs)
  • They require that we install a specific certificate and that we can validate their certificate with ours and in turn they will validate ours as well because they have our public key. I believe I should use Custom Binding -> Security -> MutualCertificate for this. I have specified the service and client certificate that should be used.

(Please notice that the WSDL implementation does not require WCF, they say consumers are free to implement it in any language. I chose to use WCF and they have a bit of documentation about it, so I think it should be supported.)

When I import their WSDL directly in SOAP UI, it says it uses SOAP 1.1. The SOAP 1.1 namespace is visible in the WSDL.

When I import my service's WSDL (Which in turns implements the interface generated by their WSDL), It uses SOAP 1.2. This is a mismatch and very annoying.

I have found this post: https://stackoverflow.com/a/22255554/3013479 and I tried to remove HttpSoap12 and add HttpSoap. I have set the MessageVersion to Soap11WSAddressing10 so it should use SOAP1.1.. But it does not work.

When i use BasicHTTPBinding without any configuration to that binding, it does use SOAP 1.1

This is my binding:

<customBinding>
    <binding>
        <textMessageEncoding writeEncoding="utf-8" messageVersion="Soap11WSAddressing10" />
        <security
            authenticationMode="MutualCertificate"
            enableUnsecuredResponse="false"
            messageProtectionOrder="EncryptBeforeSign"
            includeTimestamp="true"
            defaultAlgorithmSuite="TripleDesRsa15"
            allowSerializedSigningTokenOnReply="false"
            messageSecurityVersion="WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10"/>
      <httpsTransport requireClientCertificate="true"/>
    </binding>
  </customBinding>

I believe I need a custom binding because in one of their documents they mention some properties from a custom binding. I am not sure though! Also, this binding generates an AssymetricBinding and I believe no other default binding does this.

Does anyone have any tips? Do you guys need knowledge of the WSDL? In theory, I am not able/allowed to adjust the WSDL because then maybe the service cant connect to us anymore. If I do need to adjust the WSDL, please tell me why so I can communicate this with the company.


Solution

  • I have solved this question, the issue is a custom encoder I removed from the question because I thought it was not the item causing this issue. Even though the Custom Encoder specifies Soap11WSAddressing10, it still uses 1.2. If I use a normal TextMessageEncoder it works (but that one doesnt suit my needs). IWsdlExporter should be used to reflect that SOAP 1.1 should be used while genererating the WSDL