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.


