PHP Soapclient

In today’s Halloween edition….

– 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

About mcloide

Making things simpler, just check: http://www.mcloide.com View all posts by mcloide

2 responses to “PHP Soapclient

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: