xmlrpcConnectToServer()

Establishes a connection to an XmlRpc server on host "host" and port "port". If "secure" is TRUE, a https connection is built. Under Windows the OpenSSL installation is required. The connection is valid only as long as it is open. This means if the connection is broken, the requests for the server will fail. Using the parameter "id", the server can be identified in the following calls.

Synopsis

xmlrpcConnectToServer(string id, string host, int port [, bool

secure[, string path = "/RPC2"[, bool forceUTF = false]]]);

Parameters

Parameter Description
id Id. Can be used to identify a server.
host The host to which the connection is built.
port The port the connection is built to.
secure If TRUE = a https connection is built and an OpenSSL installation is required under Windows. See Install_HTTPS_(SSL_connections).
path Specifies the resource over which the XmlRpc service is accessed (the path component of a URL).
forceUTF

If forceUTF == TRUE, strings are always coded with UTF-8 independing of the configured languages.

If forceUTF == FALSE:

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

Return value

The function returns TRUE if the host, to which the connection should be established, exists, i.e. the name is resolvable and FALSE if the host does not exist. The return value does not inform whether the connection can be established to the defined port since a connection is established only if required and not at function call.

Description

Establishes a connection to an XmlRpc server on host "host" and port "port";. If "secure" is TRUE, a https connection is built. Under Windows the OpenSSL installation is required. The connection is valid only as long as it is open. This means if the connection is broken, the requests for the server will fail. Using the parameter "id";, the server can be identified in the following calls.

EXAMPLE

Connect to the server as follows, call the function on the server as well as close the connection to the server:

#uses "CtrlXmlRpc"
main()
{
  string id = "servID";
  string func = "wccoa.own.testmethod";
  dyn_mixed args = makeDynString("World");;
  mixed res;
  string host = "localhost";
  int port = "80";
  bool secure = FALSE;
  xmlrpcClient();
  xmlrpcConnectToServer(id, host, port, secure);
  xmlrpcCall(id, func, args, res);
  DebugN("Result of XmlRpc call", res);
  xmlrpcCloseServer(id);
}

Assignment

XML RPC

Availability

CTRL