Consuming a PHP SOAP web service from C# client
By: stlplace
Posted on January 16, 2013 at 21:38 PM EST
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 [...]

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).


============









binding="customBinding" bindingConfiguration="MyCustomBinding"
contract="ServiceReference1.productlistPortType" name="productlistPort" />






============

Happy hacking :D

Related Stocks:
Stock Market XML and JSON Data API provided by FinancialContent Services, Inc.
Nasdaq quotes delayed at least 15 minutes, all others at least 20 minutes.
Markets are closed on certain holidays. Stock Market Holiday List
By accessing this page, you agree to the following
Privacy Policy and Terms and Conditions.
Press Release Service provided by PRConnect.
Stock quotes supplied by Telekurs USA
Postage Rates Bots go here