– PHP Soapclient and some great tools –
When you actually start thinking that you will need to work with SOAP servers things became a little scary, but it’s not that hard. Actually is simple, what can actually make things a bit hard is not knowing what the soap service has and how to work with it’s methods.
I have been playing with new PHP 5 Soapclient and it is as easy as handling arrays or playing with xml, but while working with it I have figured out that I might need a extra help to work the SOAP server if I din’t knew everything from it’s methods.
A friend of mine, Julian, showed me a solution to test the SOAP server before actually creating the code. It’s a .net interface (yeah I know…) that allows you to get all the available methods from the server and allow you to simulate the results by passing the parameters to each function.
After you actually knows how the methods work all you need to remember is that the Soapclient from PHP will create for you a xml way to access the client and each method.
Just a simple example:
$client = new Soapclient(‘http://remoteserver.com/thecatalog/catalog.asmx?WSDL’);
$params = array(‘param1′ => 1,’param2’ => 2);
$method_1 = $client->aMethod($params);
$someText = $method_1->childMethod_1->aVariableText->string; // returning aVariableText as string
If you are looking for a way to create the server, the best way I found so far was using the Zend Framework tools for that. There’s a great article about this on: http://electrotek.wordpress.com/2008/04/19/soap-web-service-with-zend-framework/
Check out the tool for testing the SOAP server. You can get a copy of it at: http://www.gotdotnet.com/team/tools/web_svc/default.aspx