PHP web serivce and .NET client

Lately I decided to have some investigation into PHP and .NET web service interoperability for one of my projects. NuSOAP turned out to be very handy.

As a first step I decided to build a PHP web service:


function Add($a, $b)
return $a + $b;

$server = new soap_server;

$server->configureWSDL("MathWebService","", "", "document");

$server->register("Add", array("a"=>"xsd:int", "b"=>"xsd:int"), array("return"=>"xsd:int"));




The line containing configureWSDL is VERY important as .NET client expects web service to return document style formated response. NuSOAP by default sets style to rpc, which causes some strange exceptions on the client.

Now the client was easy just add web reference some buttons.

All of it was tested on VS 2005.

The one feature that's quite important for me, but lacks support in nuSOAP is message body encryption. It may be useful for calling non public highly sensitive web services. Though nuSOAP supports tunneling through SSL it is not a desired solution for me.