I need to create a SOAP client in C#, and in order to test it I need a SOAP web service. Since my hosting company uses MySQL/PHP technology stack, I am using this PHP Soap web service example.
For the C# soap client, I am following this example on stackoverflow. But there is one problem when I tried to run the example. I got the error (exception) like the following:
The content type text/xml; charset=ISO-8859-1 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.
Again I found this thread on stackoverflow which seems relevant. It talked about the custom message encoder developed by Microsoft, and Paul Morgado’s addition to the CustomTextMessageEncoder class (just add his method at the end of the class). There is one more thing, the configuration file for the app. In my case, it’s something like the following: (note the messageVersion and bindingElementExtensions definition, there was some error in the Microsoft documentation regarding the latter one).
< ?xml version="1.0" encoding="utf-8" ?>
contract="ServiceReference1.productlistPortType" name="productlistPort" />