Archive of UserLand's first discussion group, started October 5, 1998.

Re: Applescript XML-RPC Client

Author:James Spahr
Posted:8/18/1999; 6:00:55 AM
Topic:Applescript XML-RPC Client
Msg #:9621 (In response to 9617)
Prev/Next:9620 / 9622

Dave

I would love base64 to work. Point me to a way to do it (that hopefully does not require launching an app), and I can add it relatively easily. I'd really like myself, for projects I need this client for.

How did you do it?
Mac OS 8.6's URL access gives you a transparent http (and https!) client to use in your scripts. Late Night Software put expat in an osax. After that it was just fleshing it out..

Also, would it be possible to paste the read me into a DG message?

Applescript XML-RPC Client
version 1.3d1, 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 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.

Known Issues:
is not supported

format is a little odd, but it works. Structs are
formatted as a list of records in applescript:

{{structName:"number", structValue:12}, {structName:"str", structValue:"Hello!"}}

Please let me know about any problems, or success stories.

James
james@designframe.com


















There are responses to this message:


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

© Copyright 1998-2001 UserLand Software, Inc.