Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

nik (3476)

AOL IM: nikclayton (Add Buddy, Send Message)

Journal of nik (3476)

Tuesday October 10, 2006
05:06 AM tech meeting tonight, SOAP/XML verbosity

[ #31277 ]

There's a ( technical meeting this evening, organised by Tom Hukins.

Now I just need to finish my slides...

Which are nothing to do with what I've been working on recently. $dayjob has me wrapping a third party's SOAP API. We need to do this because although they have a very pretty web site for carrying out various back-end operations, it doesn't meet our audit requirements. It would also mean retraining our ops people to stop using our systems and start using theirs.

This is my first foray in to SOAP, and it's going reasonably well. But what hadn't occured to me is how much of the verboseness of XML would have to spill over in to my code.

I'm trying to make sure that the wrapper I'm writing is going to be easy to use for someone who's experienced with Perl, as well as looking close to the underlying API for someone who's familiar with that -- I'm not entirely sure why, as I'm not sure this code is ever going to see the light of day outside of $dayjob, but I get a definite sense of satisfaction out of doing these things properly.

Anyway, I digress.

So the responses back from the API all come back as XML, naturally, and SOAP::Lite does a reasonably good job of turning these in to useful Perl datastructures. I then convert these (hashes, normally) in to objects, and return the objects.

This forces the caller to use get_ and set_ methods to retrieve the data, which is less error prone than having them specify the hash keys directly.

And this is where the XML verbosity spills over in to the client interface. Handed XML like this:

<U seDomainDefaultSettings>...</UseDomainDefaultSettings>

the client API looks like this:

$ss->get_use_domain_ default_settings();

(not sure why u.p is inserting spaces in to some of those).

Still, I suppose it makes the code more readable in the long run.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.