I'm currently working on a project where I need to consume a Java webservice. If I connect to the service using old webservices (asmx) it works fine. However, If I try to do the same thing with a WCF client I get the following error:
The content type text/xml; charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.
My is very simple and it looks like the following:
//classic web service
OldSkoolService.HelloService serviceCall = new esb_wsdlsample.OldSkoolService.HelloService();
Console.WriteLine(serviceCall.SoapVersion);
Console.WriteLine(serviceCall.sayHello("something"));
HelloServiceClient prototypeClient = new HelloServiceClient();
var serviceChannel = prototypeClient.ChannelFactory;
Console.WriteLine(serviceChannel.Endpoint.Binding.MessageVersion);
Console.WriteLine(prototypeClient.sayHello("somethinge")); //<-- Error occurs here
The the binding/endpoint config file is quite simple as well:
<bindings>
<customBinding>
<binding name="Soap12Binding">
<textMessageEncoding messageVersion="Soap12"/>
<httpTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://10.10.6.51:7001/esb/HelloService" behaviorConfiguration=""
binding="customBinding" bindingConfiguration="Soap12Binding" contract="Prototype.ESB.HelloService"
name="HelloServicePort" />
</client>
As a side note I'm trying to use soap 1.2, because I need to be able to catch exceptions from the service.