Archive of UserLand's first discussion group, started October 5, 1998.
Applescript XML-RPC Client v1.4d1
Author: James Spahr Posted: 8/18/1999; 1:21:00 PM Topic: Applescript XML-RPC Client Msg #: 9645 (In response to 9612) Prev/Next: 9644 / 9646
ftp://ftp2.designframe.com/tools/AppleScript-XML-RPC-v1.4.sitThe client now fully supports the xml-rpc spec, including base64. Here is the new read me:
Applescript XML-RPC Client
version 1.4d1, 8.18.99
by James Spahr, james@designframe.comIn order to use this script you need the XML Tools osax from
Late Night Software. You can download it here:
http://www.latenightsw.com/freeware/XMLTools/index.htmlYou will also need Tanaka's osax, downloadable here:
http://mtlab.ecn.fpu.ac.jp/scripting/Jcode_osax.htmlYou also need to be running Mac OS 8.6 or higher
How to use:
After you place the "xmlrpc.lib" file into you scripts folder, within
your system folder, you can call the xml-rpc client from
any script like this:
tell application "Finder" set pathToxmlrpcLib to path to system folder as string end tellset pathToxmlrpcLib to pathToxmlrpcLib & "Scripts:xmlrpc.lib" set xmlrpc_client to (load script file pathToxmlrpcLib)
set serverURL to "http://www.scripting.com:81/RPC2" set serverScript to "examples.getStateList" set serverParams to {{1, 4, 45, 6}}
tell xmlrpc_client set s to xmlrpc (serverURL, serverScript, serverParams) end tell
return s
The important aspects of this example are the use of the load script
command, and the xmlrpc api. The xmlrpc api looks like this:xmlrpc (serverURL, serverScript, serverParams) server URL is a complete URL, beginning with http://, or https:// and
ending with the path to the xml-rpc serverserverScript is the name of the script to call on the remote machine
serverParams is a list of parameters to send to the server.
all arguments are required.
Using Base64
To send base64 data, pass a record type that looks like this:
{base64 : "Mary had a little lamb"}
by default the client will base64 encode the string and send the
encoded data. You can turn this feature off by using this line:tell xmlrpc_client turnOffAutoBase64() end tell
and turn it back on with:
tell xmlrpc_client turnOnAutoBase64() end tell
Auto base64 will also decode incoming base64 data into a string data
type, again this is easy to disable with the above verbs.Using Structs
To send struct data (ie records), pass a record type that looks like this:
{{structName:"number", structValue:12}, {structName:"str", structValue:"Hello!"}}
Please let me know about any problems, or success stories.
James james@designframe.com
THIS SOFTWARE IS PROVIDED AS-IS, WITHOUT WARRANTY OF ANY KIND. THE AUTHOR DISCLAIMS ANY DAMAGES RESULTING FROM THE USE OR MISUSE OF THIS SOFTWARE. THIS SOFTWARE IS NOT A PRODUCT OF DESIGNFRAME INCORPORATED.
There are responses to this message:
- Re: Applescript XML-RPC Client v1.4d1, Sam DeVore, 8/18/1999; 7:01:02 PM
- Re: Applescript XML-RPC Client v1.4d1, Steve Ivy, 8/20/1999; 1:48:36 PM
- Applescript XML-RPC Client v1.5, James Spahr, 9/5/1999; 9:04:12 PM
This page was archived on 6/13/2001; 4:51:58 PM.
© Copyright 1998-2001 UserLand Software, Inc.