On Jan 16, 2011, at 1:46 PM, Bernardo Hoehl wrote: I am trying to use applescript to talk to a webservice using the XML-RPC and SOAP Protocols as it is described here:
No matter what service I try to talk to it returns me always:
error "soap got an error: Transport error" number -916
Hi Bernardo,
That's a familiar error. Several years ago, I fought with AS's implementation of SOAP and nearly gave up. Finally, I figured out the correct format for SOAP calls. For example, here's a simple example using a silly, but free, SOAP service:
set soapResult to call soap {method name:"getRandomBushism", method namespace uri:¬ "urn:RandomBushism", SOAPAction:"urn:RandomBushism#bushism#getRandomBushism"} end tell
And here's a more complex, but imaginary, SOAP call for employee information:
set dataRecord to call soap {method name:"GetInfo", parameters:¬ {Account:{username:"stanc", |password|:"blah"}, EmployeeInfo:¬ {|name|:fullName, position:jobTitle, salary:payRate}} ¬ , method namespace uri:"urn:ActionWebService", SOAPAction:¬ "/worker_web_service/api/GetInfo"} end tell
Nesting is important. Note that the method name, parameters, method namespace uri, and SOAPAction are in a record that follows the call soap command. The parameters element is itself a nested record that contains nested records. Also note that the tell application target and the method name and SOAPAction parameters all share various bits of the desired URL, but none of the three contain the complete URL.
The above is the format that worked with the service I was accessing at the time. I don't fully understand all the parts—I just know that it works. [FYI, in case the code gets hammered in transit, each example has only three lines: The call soap is in one line between the tell application and end tell lines.]
HTH, Stan C.
|