/phpxmlrpc/xmlrpc.php
Class | Description |
---|---|
xmlrpc_client | |
xmlrpcresp | |
xmlrpcmsg | |
xmlrpcval |
decode a string that is encoded w/ "chunked" transfer encoding as defined in rfc2068 par. 19.4.6 code shamelessly stolen from nusoap library by Dietrich Ayala
- string $buffer: the string to be decoded
xml charset encoding guessing helper function.
Tries to determine the charset encoding of an XML chunk received over HTTP. NB: according to the spec (RFC 3023, if text/xml content-type is received over HTTP without a content-type, we SHOULD assume it is strictly US-ASCII. But we try to be more tolerant of unconforming (legacy?) clients/servers, which will be most probably using UTF-8 anyway...
- string $httpheaders: the http Content-type header
- string $xmlchunk: xml content buffer
- string $encoding_prefs: comma separated list of character encodings to be used as default (when mb extension is enabled)
- $httpheader
Checks if a given charset encoding is present in a list of encodings or
if it is a valid subset of any encoding in the list
- string $encoding: charset to be tested
- mixed $validlist: comma separated list of valid charsets (or array of charsets)
Given a string defining a php type or phpxmlrpc type (loosely defined: strings accepted come from javadoc blocks), return corresponding phpxmlrpc type.
NB: for php 'resource' types returns empty string, since resources cannot be serialized; for php class names returns 'struct', since php objects can be serialized as xmlrpc structs
- string $phptype
Takes an xmlrpc value in PHP xmlrpcval object format and translates it into native PHP types.
Works with xmlrpc message objects as input, too.
- xmlrpcval $xmlrpc_val
- array $options: if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects
Takes native php types and encodes them into xmlrpc PHP object format.
It will not re-encode xmlrpcval objects. Feature creep -- could support more types via optional type argument (string => datetime support has been added, ??? => base64 not yet)
- mixed $php_val: the value to be converted into an xmlrpcval object
- array $options: can include 'encode_php_objs' and 'auto_dates'
Given a user-defined PHP function, create a PHP 'wrapper' function that can be exposed as xmlrpc method from an xmlrpc_server object and called from remote clients.
Since php is a typeless language, to infer types of input and output parameters, it relies on parsing the javadoc-style comment block associated with the given function. Usage of xmlrpc native types (such as datetime.dateTime.iso8601 and base64) in the @param tag is also allowed, if you need the php function to receive/send data in that particular format (note that base64 enncoding/decoding is transparently carried out by the lib, while datetime vals are passed around as strings)
Known limitations:
- requires PHP 5.0.3 +
- only works for user-defined functions, not for PHP internal functions (reflection does not support retrieving number/type of params for those)
- functions returning php objects will generate special xmlrpc responses: when the xmlrpc decoding of those responses is carried out by this same lib, using the appropriate param in php_xmlrpc_decode, the php objects will be rebuilt. In short: php objects can be serialized, too (except for their resource members), using this function. Other libs might choke on the very same xml that will be generated in this case (i.e. it has a nonstandard attribute on struct element tags)
- usage of javadoc @param tags using param names in a different order from the function prototype is not considered valid (to be fixed?)
- string $funcname: the name of the PHP user function to be exposed as xmlrpc method; array($obj, 'methodname') might be ok too, in the future...
- $newfuncname
Given an xmlrpc client and a method name, register a php wrapper function
that will call it and return results using native php types for both params and results. The generated php 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 php function has to encode on its own the params passed to the php function if these are structs or arrays whose (sub)members include values of type datetime or base64
- xmlrpc_client $client: an xmlrpc client set up correctly to communicate with target server
- string $methodname: the xmlrpc method to be mapped to a php function
- integer $signum: the index of the method signature to use in mapping (if method exposes many sigs)
- $timeout
- $protocol
- $newfuncname
- $parser
- $name
- $rebuild_xmlrpcvals
Convert a string to the correct XML representation in a target charset
To help correct communication of non-ascii chars inside strings, regardless of the charset used when sending requests, parsing them, sending responses and parsing responses, an option is to convert all non-ascii chars present in the message into their equivalent 'charset entity'. Charset entities enumerated this way are independent of the charset encoding used to transmit them, and all XML parsers are bound to understand them. Note that in the std case we are not sending a charset encoding mime type along with http headers, so we are bound by RFC 3023 to emit strict us-ascii.
- $data
- $src_encoding
- $dest_encoding
Documentation generated on Mon, 05 Mar 2007 21:31:51 +0000 by phpDocumentor 1.3.1