SOAP 1.2 message format with BasicHttpBinding
While testing a WCF service running in IIS with a simple Axis2 client, we encountered a content type error:
org.apache.axis2.AxisFault: Transport error: 415 Error: Cannot process the message because the content type 'application/soap+xml; charset=UTF-8; action="[...]"' was not the expected type 'text/xml; charset=utf-8'.
Using MSSoapT, we could see that the content type of the request was application/soap+xml.
It is not possible to specify the message encoding in the binding section of the configuration file. Hence, the only way to make the server match the client is by using a CustomBinding that will be like BasicHttpBinding but use SOAP 1.2 instead of SOAP 1.1 as message encoding.
This can be easily achieved in the configuration file by adding a customBinding in bindings section:
<customBinding> <binding name="customHttpBinding"> <textMessageEncoding messageVersion="Soap12" /> <httpTransport/> </binding> </customBinding>
Next, change the endpoint binding to use customBinding and use the bindingConfiguration attribute to point to the newly created binding configuration (in the example, customHttpBinding).
Running the client again worked this time, and MSSoapT was showing application/soap+xml content type in request and response's HTTP headers.
blog comments powered by Disqus