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.sit

The 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.com

In 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.html

You will also need Tanaka's osax, downloadable here:
http://mtlab.ecn.fpu.ac.jp/scripting/Jcode_osax.html

You 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 tell

set 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 server

serverScript 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:


This page was archived on 6/13/2001; 4:51:58 PM.

© Copyright 1998-2001 UserLand Software, Inc.