xmlrpcEncodeResponse()

Encodes the result in an XmlRpc message.

Synopsis

xmlrpcEncodeResponse(mixed response, string &ret[, int lang = getActiveLang()[, bool forceUTF = false]]);

Parameters

Parameter Description
response The content to be encoded
ret The encoded result
alig The currently active language
forceUTF

The result is encoded according to the following schema:

If forceUTF == TRUE, then with UTF-8.

If forceUTF == FALSE:

If all configured languages are ISO8859-1, then with ISO8859-1.

Otherwise UTF-8.

Return value

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

Description

Encodes the result in an XmlRpc message.

Example

#uses "CtrlXmlRpc"
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