ANN: alpha of XML-RPC Stack.

Andre Garzia soapdog at mac.com
Sun Feb 8 23:18:57 EST 2004


Hi Folks,

I've been working in a Rev implementation for the XML-RPC spec for a 
while.  Since then I moved all my efforts to the revHTTPd framework, 
but this simple stack is a nice example of how to use XML-RPC. It's not 
as polished as SOAP Toolbox stack. Is just a simple thing I did while 
learning Rev. I think it should be created again from the scratch, but 
I do not have the time now so I am releasing the code as public domain.

You can use it by making it a library of your stack.
this is a little doc on the stack.

Globals:
gParamsA		-- Array containing the parameters.

You should not access this array unless you want to add complex types 
on your own. Each item is a "XML-RPC Item Element", or in plain 
english, it's a string with a xml piece that contains the item content 
and it's type.

---------

gXMLRPCAnswer	-- Raw XML-RPC Answer.

This is the server response in plain XML. You must parse this yourself, 
there's no built-in parsing.


---------
Functions:
---------

RevXMLRPCAddParam type, parameter.

Call this to add a parameter to gParamsA array, remember to zero it 
when you're making a new request or old parameters will be inside it. 
The first parameter is a valid XML-RPC type like: "string" or "i4", the 
other is the content. Remember that XML-RPC parameters are order based 
and not key based, so add them respecting your specs.

example:
get revXMLRPCAddParam( "string", "power to the developer")
---------

revXMLRPCRequest URL, Method

Use this to make a request. The first parameter is a valid XML-RPC 
Endpoint, the second the method to call. The return value will be 
filled with the server response. You must parse it yourself

example:
get revXMLRPCRequest  ("http://betty.userland.com/RPC2", 
"examples.getStateName")
---------

CallXMLRPC URL, Raw Request XML

Use this to make complex calls containing structs or arrays. Generate 
yourseld the XML and pipe it thru this function. This is the safe way 
to use structs or arrays. The return value will be the server answer

Example:
get field "xml request"
get CallXMLRPC("http://betty.userland.com/RPC2", it)
put it into field "answer"
---------

Tips & Tricks

Remember to zero the gParamsA array if you want to start a new call. If 
you want to add complex types and to not want to generate the code 
yourself, then just generate the needed piece of XML for your complex 
types, and add them to gParamsA by hand. This is easier than generating 
all the XML. For example: you have a call that needs a name, a 
password, an array with something. Then use revXMLRPCAddParam to add 
the name and password, generate yourself the part for the array, use 
put to insert it at gParamsA and call revXMLRPCRequest, this will work.

---------

This code is old, I am much wiser now. I would make things different, 
but, this is what I did. This was my first Rev project, you'll find all 
the mistakes of the newbies inside it, but it's a nice toy and it could 
be put to production level very easy. I am releasing it for I am not 
working in it and someone might want to look and make it better.

It's xmlrpc.zip and it's stored at http://public.soapdog.org

Anyway send comments to me at soapdog at mac.com

and our homepage is http://www.soapdog.org

Cheers
Andre
   	


-- 
Andre Alves Garzia ð 2004 ð BRAZIL
http://studio.soapdog.org



More information about the use-livecode mailing list