Change Displayed Text SizeGrow Displayed Text SizeShrink Displayed Text Size

Saturday, April 02, 2005

Web Services and Applescript: The Secret Weapon

I won't get onto a rant about web services (XML-RPC and SOAP, specifically). But I am going to show you the secret weapon for using web services from Applescript.
If you're reading this, chances are you know that Applescript can access web services on MacOS X. You may have already tried using Applescript to access a web service - and chances are you have pulled out a few hairs trying. Applescript's SOAP and XML-RPC implementation is pretty good, but leaves a bit to be desired. The description you have of a web service may seem clear cut, but translating that into an Applescript call can be very frustrating because of how Applescript names the different parts of the remote function call headers.
But enough about that. This is the easy way, assuming your web service has a WSDL description. Note that in general, web services that are coming from ASP .NET servers haven't worked well for me from any language, which is a shame since there are just so many out there. So if you see ".asmx" in your SOAP url, you may be out of luck.
Open Terminal.

cd /Developer/Tools

./WSMakeStubs -x applescript -url '' -dir ~/Desktop

Open the "" file on your desktop. You now have all of the Applescript code needed to access the web services described by the WSDL file at the url you gave WSMakeStubs. Nifty, huh?

4/02/2005 04:17:00 AM ] [  0 comments  ]
A good quick laugh