PHP calling .NET – Running WCF service with basicHttpBinding


Category : Interoperability, Microsoft, PHP, Software development

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


PHP calling .NET – PHP to WCF calls with parameters

Tip: Visual Studio 2008 fails to debug WCF web service

Category : Microsoft, Software development

When trying to debug a WCF ( windows communication foundation) .NET 3.5 framework library, you might encounter a problem where Visual Studio (VS 2008) refuses to run or debug the WCF web service.


the problem:

The error you get from the WCF test client when trying to debug the WCF service is this – "WCF Test Client: Unrecognized option ‘targetclientversion’ specified"

wcf fail

The solution:

1) Close Visual Studio

2) Install the latest version of Windows SDK for Windows Server 2008 and .NET Framework 3.5

3)  open Visual Studio again


This solved the problem for me.