[ Home | User's guide ]
User's Guide
Using the debugger is very simple. Once you start the application, you will see a window, like that in the screenshot on the main page. You can type XML-RPC calls into the box at the bottom.
First, however, we're going to have to configure which service to
use. Click on the Options
button:
Enter the URL of your RPC service in the first box. The other
two are lists of arguments that are automatically added before and
after the arguments you give to each method call. For example,
with the configuration shown above, if I execute Foo.bar("baz")
,
the actual RPC call will be to Foo.bar("-UMEREDYDD", "", "baz")
.
Prefixes and suffixes are specified as arrays, with the same
syntax as elsewhere (see below).
You probably won't need a prefix or suffix, unless your service
requires authentication or session-tracking parameters that you
don't want to have to enter every time.
Data
First, let's familiarise ourselves with data types. When you
execute a request, the debugger prints the results of that
request, whether or not there was any actual XML-RPC involved.
Let's start with a number: type 15
in the box, hit
enter, and sure enough, the result is 15
. Try a
string: "hello"
(a string must be in quotes, or
the debugger thinks you're trying to make an RPC call). Boolean
values (true
or false
, with no quotes)
are also supported.
Now for an array: ["hello", "there"]
produces
an array, with two elements, both strings. XML-RPC, of course,
allows many types within an array:
[ "one", [2, "three", 4] ]
is perfectly valid.
Arrays can also be indexed:
["zero", "one", "two"] [1]
produces
"one"
.
The result of any expression can also be assigned to a
variable: a = 3
puts the integer
value 3 into the variable a
. $a
now returns 3
.
You can combine all of the above. For example, if you
execute:
a=[ 1, 2, [b="three", "four"] ]
,
then:
$a[2][1]
returns four
$b
returns three
$a[ $a[0] ]
returns 2
Got that? Explore a bit; make sure you're comfortable with this.
Making calls
All right, we're pointing at an RPC service, we can manipulate our data - let's make some calls!
The debugger is fairly simple-minded when it comes to RPC
calls. It expects all calls to be of the form
object.method. To call Foo.bar
, with
a single string parameter, enter Foo.bar("something")
.
Return values are dealt with in the same way as anything else.
...and that's it! If you have any problems with the debugger,
or want to lend a hand improving it (proper struct
support would be really nice, for instance), just drop me a line
at meredywibbledd@users.sourceforge.net
(removing
the "wibble" as appropriate).
Some notes on types
Although all valid XML-RPC types are understood when received,
they cannot all be sent from manually entered commands. Currently,
only int
/i4
, array
,
string
and boolean
can be sent.
If a struct
is received, it can be indexed.
So, for example, if Foo.bar()
returned
{one=1, two=2}
, then
Foo.bar()["one"]
will return 1
.
It is also worth noting that although an object may not be entered from manual commands, it can still be stored in variables, and used later, with no problems. This isn't a substitute for proper support, but it gets me by... ;-)