Members
xmlrpcName :string
Library name. Used in the client's httprequests to identify self to server
Type:
- string
- Source:
(readonly) xmlrpcTypes
- Source:
xmlrpcVersion :string
Library version number. Used in the client's httprequests to identify self to server
Type:
- string
- Source:
Methods
base64_decode(aString)
Decodes a Base64 encoded string to a byte string.
Parameters:
Name | Type | Description |
---|---|---|
aString |
string |
- Source:
Throws:
exception can be raised when decoding improperly coded data
base64_encode(aString)
Encodes a string using Base64.
Parameters:
Name | Type | Description |
---|---|---|
aString |
string |
- Source:
htmlentities(val, quote_style)
Debug helper. Should do the same as the PHP htmlentities function (well, htmlspecialchars rather...).
NB: since it is ONLY used for debugging purposes, it gets disabled in WSH environments for better readability...
Parameters:
Name | Type | Description |
---|---|---|
val |
string | |
quote_style |
int |
- Source:
- To Do:
-
- encode all chars outside ASCII to html charset entity...
iso8601_decode(time, utc)
Given an ISO8601 date string, return a date obj in the localtime, or UTC
Parameters:
Name | Type | Description |
---|---|---|
time |
string | |
utc |
boolean |
- Source:
iso8601_encode(time, utc)
Given a Date object, returns its representation in the iso8601 format used by xmlrpc
Parameters:
Name | Type | Description |
---|---|---|
time |
Date | |
utc |
boolean | when True, the UTC timezone is assumed |
- Source:
jsonrpc_decode()
Takes a json value in jsonrpcval object format
and translates it into native javascript types.
- Source:
jsonrpc_decode_json(json_val, options)
Convert the json representation of a jsonrpc method call, jsonrpc method response
or single json value into the appropriate object (deserialize)
Parameters:
Name | Type | Description |
---|---|---|
json_val |
string | |
options |
object | not used (yet) |
- Source:
jsonrpc_encode()
Takes native javascript types and encodes them into jsonrpc object format.
It will not re-encode jsonrpcval objects.
- Source:
var_export(val, ret, whitespaces)
Debug helper. Mimics PHP var_export function
Parameters:
Name | Type | Description |
---|---|---|
val |
any | |
ret |
boolean | |
whitespaces |
int |
- Source:
wrap_xmlrpc_method(client, methodname, extra_options)
Given an xmlrpc client and a method name, register a js wrapper function
that will call it and return results using native js types for both
params and results. The generated js function will return an xmlrpcresp
oject for failed xmlrpc calls
Known limitations:
- server must support system.methodsignature for the wanted xmlrpc method
- for methods that expose many signatures, only one can be picked (we
could in priciple check if signatures differ only by number of params
and not by type, but it would be more complication than we can spare time)
- nested xmlrpc params: the caller of the generated js function has to
encode on its own the params passed to the js function if these are structs
or arrays whose (sub)members include values of type base64
Notes: the connection properties of the given client will be copied
and reused for the connection used during the call to the generated
js function.
Calling the generated js function 'might' be slow: a new xmlrpc client
is created on every invocation and an xmlrpc-connection opened+closed.
An extra 'debug' param is appended to param list of xmlrpc method, useful
for debugging purposes.
Parameters:
Name | Type | Description |
---|---|---|
client |
xmlrpc_client | an xmlrpc client set up correctly to communicate with target server |
methodname |
string | the xmlrpc method to be mapped to a js function |
extra_options |
object | map of options that specify conversion details. valid ptions include int signum the index of the method signature to use in mapping (if method exposes many sigs) int timeout timeout (in secs) to be used when executing function/calling remote method string protocol 'http' (default), 'http11' or 'https' string new_function_name the name of js function to create. If unsepcified, lib will pick an appropriate name string return_source if true return js code w. function definition instead of created function bool encode_js_objs let js objects be sent to server using the 'improved' xmlrpc notation, so server can deserialize them as js objects bool decode_js_objs --- WARNING !!! possible security hazard. only use it with trusted servers --- any return_on_fault a js value to be returned when the xmlrpc call fails/returns a fault response (by default the xmlrpcresp object is returned in this case). If a string is used, '%faultCode%' and '%faultString%' tokens will be substituted with actual error values bool debug set it to 1 or 2 to see debug results of querying server for method synopsis |
- Source:
Returns:
string the generated js function (or false) - OR AN ARRAY...
wrap_xmlrpc_server(client, extra_options)
Similar to wrap_xmlrpc_method, but will generate a javascript class that wraps
all xmlrpc methods exposed by the remote server as own methods.
For more details see wrap_xmlrpc_method.
Parameters:
Name | Type | Description |
---|---|---|
client |
xmlrpc_client | the client obj all set to query the desired server |
extra_options |
object | list of options for wrapped code |
- Source:
Returns:
-
any false on error, the name of the created class if all ok or an array with code, class name and comments (if the appropriate option is set in extra_options)
-
void
xmlrpc_debug_log(logmsg)
Function used to send a debug message to the log. To override the default
log handler, define the function 'xmlrpc_debug_log_handler(string logmsg)'
Parameters:
Name | Type | Description |
---|---|---|
logmsg |
string |
- Source:
xmlrpc_decode(xmlrpc_val, options)
Takes an xmlrpc value in xmlrpcval object format and translates it into native javascript types.
Works with xmlrpc message objects as input, too.
Parameters:
Name | Type | Description |
---|---|---|
xmlrpc_val |
xmlrpcval | |
options |
object | not in use (yet) |
- Source:
- To Do:
-
- add support for rebuilding non-anon js objects
xmlrpc_decode_xml(xml_val, options)
!!! TO BE IMPLEMENTED !!!
Convert the xml representation of a method response, method request or single
xmlrpc value into the appropriate object (deserialize)
Parameters:
Name | Type | Description |
---|---|---|
xml_val |
string | |
options |
object |
- Source:
Returns:
false on error, or an instance of either xmlrpcval, xmlrpcmsg or xmlrpcresp
xmlrpc_encode(js_val, options)
Takes native javascript types and encodes them recursively into xmlrpcval object format.
It will not re-encode xmlrpcval objects (ie. they can be freely mixed with native js values).
Parameters:
Name | Type | Description |
---|---|---|
js_val |
any | The value to be converted into an xmlrpcval object |
options |
object |
- Source:
xmlrpc_error_log()
Function used to send an error message to the log. To override the default
log handler, define the function 'xmlrpc_error_log_handler(string logmsg)'
- Source:
xmrlpc_set_option(option, value)
Parameters:
Name | Type | Description |
---|---|---|
option |
string | |
value |
any |
- Source: