An XML-RPC function can be a static method in a
class or a function.
The docstring is nice and easy; it tells us that this web service call 'Adds
two numbers'. This is only a human-readable string, and generally does not
carry any meaning to the client machine itself.
The signature, used to define the input and output of the call, is an array.
The output value is always the first value in the array. The remaining
elements describe the input values that a client must provide when calling
the service.
In our example, the signature tells us that the call will return a struct, and requires
two double input values. This is what the foobar.add signature value looks like:
array(array($xmlrpcStruct, $xmlrpcDouble, $xmlrpcDouble))
You may have noticed that the signature is an array of arrays. This is because service
call can have multiple signatures. Imagine we want to allow the addition of two or
three values; we would need to define two signatures, as this example demonstrates:
array(
array($xmlrpcStruct, $xmlrpcDouble, $xmlrpcDouble),
array($xmlrpcStruct, $xmlrpcDouble, $xmlrpcDouble,
$xmlrpcDouble)
)
???
???
???
Chapter 10
[ 305 ]
Now that we have defined the web service calls, we need to create the procedures
that drive them.
Pages:
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420