xmlrpcDecodeRequest()

Decodes the request and extracts the function name and arguments of it.

Synopsis

xmlrpcDecodeRequest(string content, string &function, dyn_mixed

&args);

Parameters

Parameter Description
content The content to be decoded
function The extracted function
args The extracted arguments

Return value

The function returns 0 if it was executed successfully and -1 in case of errors.

Description

Decodes the request and extracts the function name and arguments of it.

Example

#uses "CtrlXmlRpc"
#uses "CtrlHTTP"
main()
{
  httpServer(false, 80);
  httpConnect("xmlrpcHandler", "/RPC2");
}
mixed xmlrpcHandler(string content)
{
  // content is the content
  // decode content
  string function;
  dyn_mixed args;
  xmlrpcDecodeRequest(content, function, args);
  //DecodeRequest
  // Execute a little bit different according to the function
  mixed result;
  switch (function)
  {
    case "test" :
    result = test(args[1]);
    break;
  }
  // Encode the result again and return to the server
  string ret;
  xmlrpcEncodeResponse(result, ret);
  return ret;
}

Assignment

XML RPC

Availability

CTRL