The xmlrpc_call tool is a small Unix terminal program for accessing basic XML-RPC services using the Unix shell. It's very useful for discovering the functionality of the OGo XML-RPC daemon (or other XML-RPC daemons).

Note: Make sure that you have loaded the OGo environment before calling xmlrpc_call, otherwise the shell will neither find the tool nor the libraries required by the tool.

Update: This is not required anymore for SOPE 4.3 installed in FHS locations!

Sourcing the OpenGroupware.org environment:

source /opt/opengroupware.org/OpenGroupware.org.sh

Usage

The tool is invoked by passing the URL of the server you are going to access. If you do not specifiy a method, the tool will query the server for a list of the implemented methods (using the system.listMethods capability).

xmlrpc_call <url> [<method-name>] [<arg1>,...]

Update: Meerkat is down, we need another testserver.

First an example for accessing a public XML-RPC webservice: Meerkat. To list the methods Meerkat provides:

helge@dogbert:~> xmlrpc_call \
http://www.oreillynet.com/meerkat/xml-rpc/server.php
meerkat.getChannels
meerkat.getCategories
meerkat.getCategoriesBySubstring
meerkat.getChannelsByCategory
meerkat.getChannelsBySubstring
meerkat.getItems
system.listMethods
system.methodHelp
system.methodSignature

To access a method of the server:

helge@dogbert:~> xmlrpc_call \
  http://www.oreillynet.com/meerkat/xml-rpc/server.php \
  meerkat.getChannelsBySubstring \
  "XML.com"
title=XML News from PerlXML.com
id=718
title=XML.com
id=47
title=XML.com Cover Page
id=5016
title=XML.com Resource Guide
id=4637

You currently cannot call services which require a typed parameter since you can only pass strings in the shell. (to be improved) Note that most OGo XML-RPC methods that are specified to take an integer can also take a string (they will detect the string and coerce it to a number), so this isn't a big problem in practice.

Accessing a OGo Daemon

The only difference to Meerkat is, that the OGo daemon will prompt you for the username and the password and that the OGo daemon has about 10 times more methods.
To run a query for the available methods:

helge@dogbert:~> xmlrpc_call http://localhost:20000/RPC2
login: helge
password:
account.update
project.isdir
appointment.getById
project.fetchJobs
appointment.update
person.fetchJobs
...
enterprise.getByNumber

You can also pipe the output through sort, to get a better overview (just add "| sort" to the Unix call).
To get the attributes of the 'root' account (which always has ID 10000):

helge@dogbert:~> xmlrpc_call http://localhost:20000/RPC2 person.getById 10000
login: helge
password:
02_tel
03_tel_funk
05_tel_private
10_fax
15_fax_private
addresses=number=LS10000
email2
extendedAttrs=lastChanged=2002-12-27 15:03:01 +0100
extendedKeys=email1
id=skyrix://dogbert.in.skyrix.com:80/Sx_dogbert/10000
isComplete=1
isPrivate=0
job_title
login=root name=root
nickname=Administrator
objectVersion=1
other_title1
other_title2
phoneTypes=01_tel
phones=isAccount=1

Accessing Servers Through a Firewall / a Proxy

If you use a proxy server, you need to setup some Defaults so that xmlrpc_call can connect a public webservice:

Defaults write NSGlobalDomain WOProxy \
   '"http://proxy:8080"'

You can configure no-proxy domains using WONoProxySuffixes:

Defaults write NSGlobalDOmain WONoProxySuffixes \
   '(.mycompany.de, localhost)'