Friday, 10 November 2006

SOAP

I've been a bit of a slow convert over to the world of XML and specifically SOAP. I've never been one to be on the wave of a trend as it sweeps the world be it fashion or techie stuff. So it's only now that I've started playing with SOAP and all the fun things that it can do.

This is mostly due to having recently studied it during my uni degree (which has taken 14yrs so far).

Anyway, I've now decided having gotten SOAP working this week that it's a really cool thing and something worthy of my first post on my new blog.

For those of you that don't know SOAP is a another way of getting a remote machine to do work for you. Now perhaps you are thinking that well hey, we do this all the time with web pages, why do I need some special protocol to do the same thing.

Well, one problem with say having a script on a website that you perhaps pass some data to and it does some work and spits out some results is one of data validation. Your script needs to make sure that the data passed is what is expected.

Whilst this isn't that hard, you certainly have to be careful about it.

SOAP on the other hand, if done properly, allows you to publish an specification of what data should be passed to you (like a function call) and it's up to the sender to make sure the data is formatted correctly.

At my work I have an intranet which most things happen through, yet for some specific tasks I have a handful of machines spattered around the place. The intranet system needs to communicate with these other systems to get them to do useful things.

Until now I didn't really have a nice structured way of doing this until I discovered SOAP.

I use PHP for my scripting language and thus calling a 'function' on a remote machine looks exactly like calling a local function on the intranet. It's that easy.

Check out http://www.php.net/soap for more details.

The hardest part of the process was getting the WSDL file correct. This is a file that describes the functions available on the remote machine. For people new to XML it can be a bit daunting but I find it easy to steal from someone else who already has it working. Google is a good example. They allow you to make searches via SOAP. With PHP this is very easy to do, simply pass in the WSDL file and call the search function.

Anyway, this is my first post and I don't really know what else to say, I'm not much of a journalist yet so I'm still finding my style.

I will post more techie stuff as time goes on.

Feel free to comment on this if you wish. I'd like to hear from you.

No comments: