I am currently working on a project where I need to use the Java web service. If I connect to the service using old web services (asmx), it works fine. However, if I try to do the same with the WCF client, I get the following error:
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 you use a custom encoder, make sure that the IsContentTypeSupported method is implemented correctly.
My is very simple and looks like this:
//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 binding / endpoint configuration file is also simple:
<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 catch exceptions from the service.
source share