From 1249107af8bad0434b310bda51d2de0a429a366c Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Fri, 13 Jun 2008 20:03:39 +0000 Subject: Added "Using Associative Arrays In a Request Parameter" example to the XMLRPC userguide page. --- user_guide/libraries/xmlrpc.html | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'user_guide/libraries/xmlrpc.html') diff --git a/user_guide/libraries/xmlrpc.html b/user_guide/libraries/xmlrpc.html index e426f7008..e3d519037 100644 --- a/user_guide/libraries/xmlrpc.html +++ b/user_guide/libraries/xmlrpc.html @@ -398,9 +398,36 @@ class Xmlrpc_server extends Controller {

The client you created sends a message ("How's is going?") to the server, along with a request for the "Greetings" method. The Server receives the request and maps it to the "process" function, where a response is sent back.

+

Using Associative Arrays In a Request Parameter

+ +

If you wish to use an associative array in your method parameters you will need to use a struct datatype:

+ +$request = array(
+                  array(
+                        // Param 0
+                        array(
+                              'name'=>'John'
+                              ),
+                              'struct'
+                        ),
+                        array(
+                              // Param 1
+                              array(
+                                    'size'=>'large',
+                                    'shape'=>'round'
+                                    ),
+                              'struct'
+                        )
+                  );
+ $this->xmlrpc->request($request);
+ +

You can retrieve the associative array when processing the request in the Server.

+$parameters = $request->output_parameters();
+ $name = $parameters['0']['name'];
+ $size = $parameters['1']['size'];
+ $size = $parameters['1']['shape'];
-

 

XML-RPC Function Reference

$this->xmlrpc->server()

-- cgit v1.2.3-24-g4f1b