PHPXMLRPC-EXTRAS

JSWrapper
in package

AJAX extension to the PHPXMLRPC lib (works with json-rpc, too).

Makes use of the js-xmlrpc lib. Original idea taken from the PHP-O-Lait library by Craig Mason-Jones

Tags
todo

add a js object wrapper for all web services if user prefers oop instead of plain function names (see php-o-lait for an example), or at least a name prefix for all created functions, to prevent js namespace pollution

todo

find a fix for xm-rpc methods whose name contain chars invalid in js function names (eg. '.')

Table of Contents

Methods

importLibs()  : string
Return html code to load all needed jsxmlrpc libs.
wrapDispatchMap()  : string
Same functionality as 'js_wrap_xmlrpc_server', but needs only the server dispatch map (and an optional server type) , not the server itself.
wrapXmlrpcMethod()  : mixed
Return js code providing a function to call a method of an xml-rpc server.
wrapXmlrpcServer()  : string
Return js code providing functions to call all methods of an xml-rpc server.

Methods

importLibs()

Return html code to load all needed jsxmlrpc libs.

public importLibs(string $jsLibsPath[, string $protocol = 'xmrlpc' ][, string $jsLibsType = 'jsxmlrpc' ]) : string
Parameters
$jsLibsPath : string
$protocol : string = 'xmrlpc'

either 'xmlrpc' or 'jsonrpc'

$jsLibsType : string = 'jsxmlrpc'

currently only 'jsxmlrpc'

Return values
string

wrapDispatchMap()

Same functionality as 'js_wrap_xmlrpc_server', but needs only the server dispatch map (and an optional server type) , not the server itself.

public wrapDispatchMap(array<string|int, mixed> $dispatchMap, string $url[, string $libUrl = '' ][, array<string|int, mixed> $methodList = null ][, string $protocol = 'xmlrpc' ][, string $jsLibsType = 'jsxmlrpc' ]) : string
Parameters
$dispatchMap : array<string|int, mixed>

an xmlrpc server dispatch map

$url : string

url at which the xml-rpc server responds

$libUrl : string = ''

url of the jsxmlrpc lib (see ... docs for more info)

$methodList : array<string|int, mixed> = null

list of methods to be wrapped into js (or null = wrap all)

$protocol : string = 'xmlrpc'

either 'xmlrpc' or 'jsonrpc'

$jsLibsType : string = 'jsxmlrpc'

only 'jsxmlrpc' supported atm

Return values
string

the js code snippet defining js functions that wrap web services

wrapXmlrpcMethod()

Return js code providing a function to call a method of an xml-rpc server.

public wrapXmlrpcMethod(mixed $method, mixed $url[, mixed $libUrl = '' ][, mixed $protocol = 'xmrlpc' ][, mixed $jsLibsType = 'jsxmlrpc' ]) : mixed

Note that method names should NOT contain dot characters, nor url contain double quotes

Parameters
$method : mixed
$url : mixed
$libUrl : mixed = ''
$protocol : mixed = 'xmrlpc'
$jsLibsType : mixed = 'jsxmlrpc'
Tags
todo

catch run-time xmlrpc exceptions without a js alert

wrapXmlrpcServer()

Return js code providing functions to call all methods of an xml-rpc server.

public wrapXmlrpcServer(Server $server, string $url[, string $libUrl = '' ][, array<string|int, mixed> $methodList = null ][, string $jsLibsType = 'jsxmlrpc' ]) : string

Note that method names with a . will not work!

Parameters
$server : Server
$url : string

url at which the xmlrpcserver responds

$libUrl : string = ''

url of the jsolait lib (see jsolait docs for more info)

$methodList : array<string|int, mixed> = null

list of methods to be wrapped into js (or null == expose all methods)

$jsLibsType : string = 'jsxmlrpc'

only 'jsxmlrpc' supported atm

Return values
string

the js code snippet defining js functions that wrap web services


        
On this page

Search results