PHP calling .NET – Running WCF service with basicHttpBinding

I am Writing a PHP application that needs to run a back end .NET application. When creating a running the WCF web service out of the box, the PHP could not connect to the web service.

The problem:

The PHP returns "Caught exception: Cannot process the message because the content type ‘text/xml; charset=utf-8’ was not the expected type ‘application/soap+xml; charset=utf-8’."

 

The reason:

WCF is running a new version of web services than expected by the PHP.

 

The solution:

Change the binding type of the WCF service from binding="wsHttpBinding" to binding="basicHttpBinding".

This insures that your .NET web service would support clients and other services that conform to the WS-I standards.

 



You can see an example of such configuration in my blog posts named:

PHP calling .NET – PHP to WCF communication

and

PHP calling .NET – PHP to WCF calls with parameters

Share the love...Tweet about this on TwitterShare on LinkedInShare on Google+Share on Facebook

Amir Shevat

Amir Shevat is the global Startup Outreach lead in Google Developer Relations (g.co/launch). Previously, Amir Led Google Campus Tel Aviv and was the co founder of several startups.

You may also like...

2 Responses

  1. Anonymous says:

    Thanks man!

  2. anonymous says:

    I was working on this for a long time, this post solved it.
    Thanks!!

Leave a Reply

Your email address will not be published. Required fields are marked *