|
@@ -1,3 +1,5 @@
|
|
|
|
+The XMLRPC Module
|
|
|
|
+
|
|
Jan Janak
|
|
Jan Janak
|
|
|
|
|
|
iptelorg GmbH
|
|
iptelorg GmbH
|
|
@@ -5,33 +7,24 @@ Jan Janak
|
|
Copyright © 2005 iptelorg GmbH
|
|
Copyright © 2005 iptelorg GmbH
|
|
__________________________________________________________________
|
|
__________________________________________________________________
|
|
|
|
|
|
- 1.1. Design Goals
|
|
|
|
- 1.2. Overview of Operation
|
|
|
|
- 1.3. XML-RPC Implementation
|
|
|
|
-
|
|
|
|
- 1.3.1. Requests
|
|
|
|
- 1.3.2. Replies
|
|
|
|
- 1.3.3. Type Conversion
|
|
|
|
- 1.3.4. Limitations
|
|
|
|
- 1.3.5. Interoperability Problems
|
|
|
|
-
|
|
|
|
- 1.4. Client Examples
|
|
|
|
- 1.5. Parameters
|
|
|
|
|
|
+ List of Tables
|
|
|
|
|
|
- 1.5.1. route (string)
|
|
|
|
- 1.5.2. autoconversion (string)
|
|
|
|
- 1.5.3. escape_cr (integer)
|
|
|
|
- 1.5.4. double_lf_to_crlf (integer)
|
|
|
|
- 1.5.5. mode (integer)
|
|
|
|
- 1.5.6. url_skip (str)
|
|
|
|
- 1.5.7. url_match (str)
|
|
|
|
|
|
+ 1. Data Type Conversion
|
|
|
|
|
|
- 1.6. Functions
|
|
|
|
|
|
+ List of Examples
|
|
|
|
|
|
- 1.6.1. dispatch_rpc()
|
|
|
|
- 1.6.2. xmlrpc_reply(code, reason)
|
|
|
|
|
|
+ 1.
|
|
|
|
+ 2. Set route parameter
|
|
|
|
+ 3. Set the autoconversion parameter
|
|
|
|
+ 4. Set the escape_cr parameter
|
|
|
|
+ 5. Set the double_lf_to_crlf parameter
|
|
|
|
+ 6. Set the mode parameter
|
|
|
|
+ 7. Set url_skip parameter
|
|
|
|
+ 8. Set url_match parameter
|
|
|
|
+ 9. dispatch_rpc usage
|
|
|
|
+ 10. xmlrpc_reply usage
|
|
|
|
|
|
-1.1. Design Goals
|
|
|
|
|
|
+1. Design Goals
|
|
|
|
|
|
* Implemented as a module.
|
|
* Implemented as a module.
|
|
* API independent of transport protocols.
|
|
* API independent of transport protocols.
|
|
@@ -42,7 +35,7 @@ Jan Janak
|
|
* Easy and straightforward implementation of management functions in
|
|
* Easy and straightforward implementation of management functions in
|
|
SER modules.
|
|
SER modules.
|
|
|
|
|
|
-1.2. Overview of Operation
|
|
|
|
|
|
+2. Overview of Operation
|
|
|
|
|
|
This module implements the XML-RPC transport and encoding interface for
|
|
This module implements the XML-RPC transport and encoding interface for
|
|
ser RPCs.
|
|
ser RPCs.
|
|
@@ -283,7 +276,13 @@ if (method == "POST" || method == "GET") {
|
|
break;
|
|
break;
|
|
};
|
|
};
|
|
|
|
|
|
-1.3. XML-RPC Implementation
|
|
|
|
|
|
+3. XML-RPC Implementation
|
|
|
|
+
|
|
|
|
+ 3.1. Requests
|
|
|
|
+ 3.2. Replies
|
|
|
|
+ 3.3. Type Conversion
|
|
|
|
+ 3.4. Limitations
|
|
|
|
+ 3.5. Interoperability Problems
|
|
|
|
|
|
The purpose of the functions of this module is to convert XML-RPC
|
|
The purpose of the functions of this module is to convert XML-RPC
|
|
document carried in the body of HTTP requests into data returned by the
|
|
document carried in the body of HTTP requests into data returned by the
|
|
@@ -298,7 +297,7 @@ if (method == "POST" || method == "GET") {
|
|
server and for each function it can return the documentation string
|
|
server and for each function it can return the documentation string
|
|
describing the function.
|
|
describing the function.
|
|
|
|
|
|
-1.3.1. Requests
|
|
|
|
|
|
+3.1. Requests
|
|
|
|
|
|
Requests processed by the module are standard XML-RPC requests encoded
|
|
Requests processed by the module are standard XML-RPC requests encoded
|
|
in bodies of HTTP requests.
|
|
in bodies of HTTP requests.
|
|
@@ -322,7 +321,7 @@ Content-Length: 112
|
|
all export RPC functions, prepare the context for the function and
|
|
all export RPC functions, prepare the context for the function and
|
|
execute it.
|
|
execute it.
|
|
|
|
|
|
-1.3.2. Replies
|
|
|
|
|
|
+3.2. Replies
|
|
|
|
|
|
The module will always generate 200 OK. Other response codes and
|
|
The module will always generate 200 OK. Other response codes and
|
|
classes are reserved for SER. The status code of the XML-RPC reply,
|
|
classes are reserved for SER. The status code of the XML-RPC reply,
|
|
@@ -405,7 +404,7 @@ Content-Length: 276
|
|
|
|
|
|
This is probably the most common scenario.
|
|
This is probably the most common scenario.
|
|
|
|
|
|
-1.3.3. Type Conversion
|
|
|
|
|
|
+3.3. Type Conversion
|
|
|
|
|
|
The data types of the RPC API are converted to the data types of
|
|
The data types of the RPC API are converted to the data types of
|
|
XML-RPC and vice versa. Table 1, "Data Type Conversion" shows for each
|
|
XML-RPC and vice versa. Table 1, "Data Type Conversion" shows for each
|
|
@@ -434,7 +433,7 @@ Content-Length: 276
|
|
</member>
|
|
</member>
|
|
</struct>
|
|
</struct>
|
|
|
|
|
|
-1.3.4. Limitations
|
|
|
|
|
|
+3.4. Limitations
|
|
|
|
|
|
SER xmlrpc modules does not implement all data types allowed in
|
|
SER xmlrpc modules does not implement all data types allowed in
|
|
XML-RPC. As well it does not implement arrays and nested structures.
|
|
XML-RPC. As well it does not implement arrays and nested structures.
|
|
@@ -443,7 +442,7 @@ Content-Length: 276
|
|
need all the bells and whistles of XML-RPC. Parsing and interpreting
|
|
need all the bells and whistles of XML-RPC. Parsing and interpreting
|
|
nested structures is complex and we try to avoid it.
|
|
nested structures is complex and we try to avoid it.
|
|
|
|
|
|
-1.3.5. Interoperability Problems
|
|
|
|
|
|
+3.5. Interoperability Problems
|
|
|
|
|
|
Due to a bug in Python xmlrpclib there is an interoperability problem
|
|
Due to a bug in Python xmlrpclib there is an interoperability problem
|
|
with basic clients using it: by default an xmlrpclib client expects the
|
|
with basic clients using it: by default an xmlrpclib client expects the
|
|
@@ -484,7 +483,7 @@ route[XMLRPC]{
|
|
CRLF conversion (using the double_lf_to_crlf modules parameter) and
|
|
CRLF conversion (using the double_lf_to_crlf modules parameter) and
|
|
replace CRLF with LFLF in the client queries.
|
|
replace CRLF with LFLF in the client queries.
|
|
|
|
|
|
-1.4. Client Examples
|
|
|
|
|
|
+4. Client Examples
|
|
|
|
|
|
* examples/xmlrpc_test.pl (basic perl application that builds and
|
|
* examples/xmlrpc_test.pl (basic perl application that builds and
|
|
sends an XMLRPC request from its commandline parameters).
|
|
sends an XMLRPC request from its commandline parameters).
|
|
@@ -495,9 +494,17 @@ route[XMLRPC]{
|
|
* serweb (php application that can use the XML-RPC interface to call
|
|
* serweb (php application that can use the XML-RPC interface to call
|
|
ser functions).
|
|
ser functions).
|
|
|
|
|
|
-1.5. Parameters
|
|
|
|
|
|
+5. Parameters
|
|
|
|
+
|
|
|
|
+ 5.1. route (string)
|
|
|
|
+ 5.2. autoconversion (string)
|
|
|
|
+ 5.3. escape_cr (integer)
|
|
|
|
+ 5.4. double_lf_to_crlf (integer)
|
|
|
|
+ 5.5. mode (integer)
|
|
|
|
+ 5.6. url_skip (str)
|
|
|
|
+ 5.7. url_match (str)
|
|
|
|
|
|
-1.5.1. route (string)
|
|
|
|
|
|
+5.1. route (string)
|
|
|
|
|
|
Name of the route called for XMLRPC messages.
|
|
Name of the route called for XMLRPC messages.
|
|
|
|
|
|
@@ -515,7 +522,7 @@ route[XMLRPC]{
|
|
Example 2. Set route parameter
|
|
Example 2. Set route parameter
|
|
modparam("xmlrpc", "route", "route_for_xmlrpcs")
|
|
modparam("xmlrpc", "route", "route_for_xmlrpcs")
|
|
|
|
|
|
-1.5.2. autoconversion (string)
|
|
|
|
|
|
+5.2. autoconversion (string)
|
|
|
|
|
|
Enable or disable automatic parameter type conversion globally, for all
|
|
Enable or disable automatic parameter type conversion globally, for all
|
|
the methods parameters. If on, a type mismatch in a method parameter
|
|
the methods parameters. If on, a type mismatch in a method parameter
|
|
@@ -532,7 +539,7 @@ modparam("xmlrpc", "route", "route_for_xmlrpcs")
|
|
Example 3. Set the autoconversion parameter
|
|
Example 3. Set the autoconversion parameter
|
|
modparam("xmlrpc", "autoconversion", 1)
|
|
modparam("xmlrpc", "autoconversion", 1)
|
|
|
|
|
|
-1.5.3. escape_cr (integer)
|
|
|
|
|
|
+5.3. escape_cr (integer)
|
|
|
|
|
|
Enable CR ('\r') escaping in replies. If enabled each '\r' in the
|
|
Enable CR ('\r') escaping in replies. If enabled each '\r' in the
|
|
xmlrpc reply will be replaced with "
", according to the xml spec.
|
|
xmlrpc reply will be replaced with "
", according to the xml spec.
|
|
@@ -545,7 +552,7 @@ modparam("xmlrpc", "autoconversion", 1)
|
|
Example 4. Set the escape_cr parameter
|
|
Example 4. Set the escape_cr parameter
|
|
modparam("xmlrpc", "escape_cr", 1)
|
|
modparam("xmlrpc", "escape_cr", 1)
|
|
|
|
|
|
-1.5.4. double_lf_to_crlf (integer)
|
|
|
|
|
|
+5.4. double_lf_to_crlf (integer)
|
|
|
|
|
|
When enabled double LFs ('\n\n') in the input xmlrpc strings will be
|
|
When enabled double LFs ('\n\n') in the input xmlrpc strings will be
|
|
replaced with CR LF ('\r\n'). This makes LF LF behave like an escape
|
|
replaced with CR LF ('\r\n'). This makes LF LF behave like an escape
|
|
@@ -563,7 +570,7 @@ modparam("xmlrpc", "escape_cr", 1)
|
|
Example 5. Set the double_lf_to_crlf parameter
|
|
Example 5. Set the double_lf_to_crlf parameter
|
|
modparam("xmlrpc", "double_lf_to_crlf", 1)
|
|
modparam("xmlrpc", "double_lf_to_crlf", 1)
|
|
|
|
|
|
-1.5.5. mode (integer)
|
|
|
|
|
|
+5.5. mode (integer)
|
|
|
|
|
|
When set to 1, xmlrpc module does not register to core the callback
|
|
When set to 1, xmlrpc module does not register to core the callback
|
|
functions for non-SIP messages. Useful when other module register a
|
|
functions for non-SIP messages. Useful when other module register a
|
|
@@ -575,7 +582,7 @@ modparam("xmlrpc", "double_lf_to_crlf", 1)
|
|
Example 6. Set the mode parameter
|
|
Example 6. Set the mode parameter
|
|
modparam("xmlrpc", "mode", 1)
|
|
modparam("xmlrpc", "mode", 1)
|
|
|
|
|
|
-1.5.6. url_skip (str)
|
|
|
|
|
|
+5.6. url_skip (str)
|
|
|
|
|
|
Regular expression to match the HTPP URL. If there is match, then
|
|
Regular expression to match the HTPP URL. If there is match, then
|
|
xmlrpc route is not executed.
|
|
xmlrpc route is not executed.
|
|
@@ -587,7 +594,7 @@ modparam("xmlrpc", "mode", 1)
|
|
modparam("xmlrpc", "url_skip", "^/sip")
|
|
modparam("xmlrpc", "url_skip", "^/sip")
|
|
...
|
|
...
|
|
|
|
|
|
-1.5.7. url_match (str)
|
|
|
|
|
|
+5.7. url_match (str)
|
|
|
|
|
|
Regular expression to match the HTTP URL. If there is no match, then
|
|
Regular expression to match the HTTP URL. If there is no match, then
|
|
xmlrpc route is not executed. This check is done after url_skip, so if
|
|
xmlrpc route is not executed. This check is done after url_skip, so if
|
|
@@ -601,9 +608,12 @@ modparam("xmlrpc", "url_skip", "^/sip")
|
|
modparam("xmlrpc", "url_match", "^/RPC2")
|
|
modparam("xmlrpc", "url_match", "^/RPC2")
|
|
...
|
|
...
|
|
|
|
|
|
-1.6. Functions
|
|
|
|
|
|
+6. Functions
|
|
|
|
+
|
|
|
|
+ 6.1. dispatch_rpc()
|
|
|
|
+ 6.2. xmlrpc_reply(code, reason)
|
|
|
|
|
|
-1.6.1. dispatch_rpc()
|
|
|
|
|
|
+6.1. dispatch_rpc()
|
|
|
|
|
|
This function processes an XMLRPC request, found in the body of the
|
|
This function processes an XMLRPC request, found in the body of the
|
|
request.
|
|
request.
|
|
@@ -630,7 +640,7 @@ route[XMLRPC]{
|
|
dispatch_rpc();
|
|
dispatch_rpc();
|
|
}
|
|
}
|
|
|
|
|
|
-1.6.2. xmlrpc_reply(code, reason)
|
|
|
|
|
|
+6.2. xmlrpc_reply(code, reason)
|
|
|
|
|
|
This function can be called from the config script to directly generate
|
|
This function can be called from the config script to directly generate
|
|
an XML-RPC reply.
|
|
an XML-RPC reply.
|