Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
XML-RPC Server
Last updated at 12:01 am UTC on 17 January 2006
I've implemented a small XML-RPC Server for squeak. XML-RPC is a very tight spec for using xml and http for webservices. Although not as full blown as SOAP, it is understandable (you can learn everything about it on one evening), and it's easy to extend.

Another advantage is that, due to its simplicity, XMLRPC-clients and -servers have been implemented in various languages, look at http://www.xmlrpc.com/directory/1568/implementations.

Usage: Get the XMLRPC-Client, YAXO and Comanche, then load the DVS package XMLRPC-Server.st. Then do:
XMLRPCHttpModule start.

The usage of the server could be found in XMLRPCStandardValidator class and XMLRPCServerTest.
Short: Write a class MyClass that response to myMthd: aCollection (aCollection contains the parameters of the methodcall), then evaluate
XMLRPCServerRequest
	registerService: 'myname.myMthd'
	class: MyClass
	selector: #myMthd:.

How to test it?

File the changeset after the XML-RPC client in, the evaluate the following:
XMLRPCServerRequest initialize. XMLRPCStandardValidator addTests. XMLRPCHttpModule start

Then you can validate the server with the XMLRPC-Validator (address is your IP, port is 8200, the path could be anything). It passes the whole testsuite.

How to learn more?

For now, look at
XMLRPCStandardValidator class>>#xmlrpcMethodCall:
. Be aware, that a methodcall should only return

any other instance of Object will be encoded as a struct (dictionary) with the instanceVariableNames as key and the value as value, nil is encoded as '<value>nil</value>'.



XMLRPC for ComancheNG:

(ComancheHttpService on: 8200 named: 'XML-RPC')
onRequestDispatch: #process: to: XMLRPCHttpModule new;
start


XMLRPC does not work

Goto
XMLNodeWithElements>>elementAt:ifAbsent:
and exchange "key" with "name".



Depends:
Spy-XML-RPC
Comanche
YAXO

Markus Fritsche

ToDo:

Special thanks to Christian Langreiter for the squeak XML-RPC client, which gave me an idea how to begin and Dustin Sallings for a more up-to-date XMLRPC client.

This new version should world with Comanche5 and Stephen Pair's Kom 6.1