I’m no Noah McCullough but,

I do plan to run the world one day. One of the first things I’m going to do as I take my plenipetentiary position on top of the world is banish the SOAP protocol to the same pit as Cold Fusion.

It’s taken 7 hours to convince the PHP 5 SOAP extension to consume a webservice provided by a server implemented in ASP.net. This is being used as part of a multi-site seamless login between a site run for one of our clients by a third party and our own new internal comms system for the client.

To be fair to the other company they had their SOAP server implemented in the wink of an eye, so I took a look at the SOAP specs (http://www.w3.org/TR/soap/) which are mind-numbing. Then I took a look at the PHP manual for the extension (http://www.php.net/manual/en/ref.soap.php) which is really quite thin on the ground, and then decided to use the Zend Framework classes for SOAP (http://framework.zend.com/manual/en/zend.soap.html).

All I was getting for ages from the Zend class was a ‘NULL’, no errors, exceptions or faults, just null. I confirmed the server was working okay with the lovely ‘SOAP client’ from Scandalous Software (http://scan.dalo.us/) (I really need to go look at the rest of their tools).

So lets see what the raw response to the SOAP call is, hmmmm it seems that despite setting up all the parameters the request is only going out with the first attached.

At this point I spend hours buggering about in every direction, googling like a mad man, playing with nuSoap (http://sourceforge.net/projects/nusoap/) and generally winding myself into madness.

The net is quite full of poeple complaining that PHPs SOAP wont talk to .net, well here’s the code that finally does, it’s all using the PHP extension with no additional classes or class abstractions…..

$client = new SoapClient('http://www.example.com/examplewebservice/service1.asmx?WSDL',array('exceptions'=>true));
$param = array("param1"=>1234,"param2"=>'1234');
$result = $client->methodname($param);

And that was it, $result became a PHP standard object with a property for each response.
If you’re struggling with SOAP and .net maybe all you need to do is simplify, I hope it saves someone a bit of the time I lost.

Leave a Reply

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

Connect with Facebook

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">