2.2. Sources From Introspection

Another possibility to create source code is to "ask" the XML-RPC server about the available methods and generate minimal source code fragments. The fragments also contain all available information like method signature and description.

To gather this information you invoke application introspect. Most of the XML-RPC servers support some standard methods which return information about the available methods:


  introspect --host=localhost:32000  --cpp-impl=dump.cpp --cpp-decl=dump.h

There are several options to control this application:

--host=hostname/resource:port

The most important option is the desired XML-RPC host. Optionally you can add a resource name and a port number in standard notation. The resource defaults to RPC2 an the standard port number is 80. Therefor --host=localhost is the same as --host=localhost:80/RPC2.

--cpp-decl=filename

This enables the gneration of the source code fragment for the declaration in a C++ class header. You can either #include this file or copy-and-paste it.

--cpp-impl=filename

The second code fragment concerns the implementation of the member variables and is intended to be placed in a constructor list.

--use-proxy=hostname:port

In case you are located behind a HTTP proxy or firewall you will need to pass the according proxy to connect to the remote server.

The generated header fragment will contain one or more blocks similar to the following:


  // signature: struct system.getCapabilities(void)                 1
  // purpose:   Returns Structs describing available capabilities.  2
  ulxr::MethodCall system_getCapabilities;                          3

1

A simplified signature of the method.

2

A short description.

3

A variable declation of this method call.

The generated implementation lists the member contructors and basically only contains the according method names:


  , system_getCapabilities (ULXR_PCHAR("system.getCapabilities"))
  , system_listMethods (ULXR_PCHAR("system.listMethods"))
  , system_methodHelp (ULXR_PCHAR("system.methodHelp"))
  , system_methodSignature (ULXR_PCHAR("system.methodSignature"))