13.13. Web Services: XML-RPC and SOAP
XML-RPC and SOAP are services that work over the Internet. They let you access software over the web, so they are referred to as web services. Just in case you're curious, XML stands for Extensible Markup Language, RPC is an abbreviation for Remote Procedure Call, and SOAP stands for Simple Object Access Protocol. XML-RPC was developed in the late 1990s. SOAP, which came after XML-RPC, is more complex than XML-RPC and is still an evolving standard.
You can use web services to execute the software that they store by targeting an HTTP address to the application in a tell block. Inside the tell block, you make the call to the service, passing along any required parameters. This request is translated into XML and then sent to the specified location. The result is returned (also as XML) to your program, where it can be assigned to a variable, copied to the clipboard, and so on. This translation to and from XML is automatically handled for you, so you don't need to learn XML to use these services.
AppleScript supports interaction with SOAP and XML-RPC through two commands: call soap and call xmlrpc.
You can explore various websites to find SOAP and XML-RPC services. Some are free of charge; other services may require you to subscribe. The website http://xmethods.net is a good place to look. Consult Appendix C for some more resources.
The general format for making an XML-RPC request from AppleScript is as follows:
tell application XML-RPC-URL set ...
Get Beginning AppleScript® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.