Skip to content
Fuchs-David edited this page Feb 9, 2019 · 14 revisions

Libxmlrpc

Libxmlrpc is an open source module designed to provide XML-RPC server functionality to applications written in the Prolog language.

Using libxmlrpc

To use this module in your application, you need to follow these steps:

  1. Put the predicates that you want to expose through XML-RPC into a module.
  2. You need to export at least one predicate which takes 2 arguments - first is for your output while the second one is input.
  3. Register your module by calling predicate register with your module's name as an argument like in this example: register('NameOfYourModule').
  4. To start the server you have several options:
  • Use the server/0 predicate to start server listening on the default port of 8080.
  • Use the server/1 predicate to specify the port you want.
  • Use the server/2 predicate to specify the port and SSL information (certificate file location, key file location, password) in the following way: ssl(["certificate-file","key-file","password"]). This is the recommended option for servers accessible from the internet.

Description of module API

This section should show you everything you need to know about what this module expects from your application and what you can expect from this module.

Input

Input (from the application's perspective) is composed of a flat list.

Future versions of this module may introduce support for multi-layer lists and compounds (structs in XML-RPC).

Output

Output (from the application's perspective) is composed of either a flat list, which may contain any atomic type, or a compound describing a fault in the following manner: fault(faultCode('YourFaultCode'),faultString('YourFaultString'))

It is recommended to only use the following codes directly from within your application:

  • -32602 ---> server error. invalid method parameters
  • -32500 ---> application error
  • -32099 .. -32000 ---> any error message

Support of more standard faults from http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php may appear in the future.

Clone this wiki locally