Search
Powered by Squarespace
Stalk Richard

 
Article Topics
« Lack of Control in OS X development | Main | SWT StyledText SuperClass »
Monday
Jul142008

Challenge with calling SOAP services via Applescript

I recently had a need to call a SOAP service via applescript. Google to the rescue and I found several examples on the web. At first it appeared that there was an older technique which used sort of an Applescript to Perl bridge to call the service. Later it seems that there is a "call soap" routine built into the System framework on OS X and callable directly from applescript. This makes for some pretty simple looking applescript. I am struggling with issues however calling web services that where built on .NET frameworks. Something seems to be missing in terms of passing parameters to the web service.

Ok I put a log into the web service to watch what comes accross the wire, there's nothing like sniffing your own code :). The service was expecting this:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetRecordERD xmlns="http://bla.bla.bla/DUWSPSERD">
<STRRECORD>string</STRRECORD>
</GetRecordERD>
</soap:Body>
</soap:Envelope>


And applescript was actually sending something like this:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<m:GetRecordERD xmlns:m="http://bla.bla.bla/DUWSPSERD">
<STRRECORD xsi:type="xsd:string">JOB</STRRECORD>
</m:GetRecordERD>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Time for some more research.

Reader Comments (1)

Arrg! I'm having the same problem (and apparently so is this guy: http://lists.apple.com/archives/applescript-studio/2007/Apr/msg00038.html)

Basically, I've found that Applescript support for anything XML is SEVERELY lacking and flawed. The problem is that it's adding a namespace ("m"? what?) to the method parameters and most SOAP servers don't like that. Thankfully Apple at least lets you call command line programs so I guess I'm moving over to that!

Geez, and you'd think after 4 major OS revisions they could have fixed this... guess they're spending all their time on making the new laptop look more sleek or thinner or have fancier drop shadows or something stupid like that.

February 23, 2009 | Unregistered CommenterTyler

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>