REST service server implementation.
More...
|
| __construct ($authmethod) |
| Contructor.
|
|
| set_rest_format () |
| Set the request format to.
|
|
|
| generate_error ($ex) |
| Build the error information matching the REST returned value format (JSON or XML)
|
|
| parse_request () |
| This method parses the $_POST and $_GET superglobals and looks for the following information: 1/ user authentication - username+password or token (wsusername, wspassword and wstoken parameters) 2/ function name (wsfunction parameter) 3/ function parameters (all other parameters except those above) 4/ text format parameters 5/ return rest format xml/json.
|
|
| send_error ($ex=null) |
| Send the error information to the WS client formatted as XML document.
|
|
| send_headers () |
| Internal implementation - sending of page headers.
|
|
| send_response () |
| Send the result of function call to the WS client formatted as XML document.
|
|
|
static | xmlize_result ($returns, $desc) |
| Internal implementation - recursive function producing XML markup.
|
|
|
string | $restformat |
| return method ('xml' or 'json')
|
|
REST service server implementation.
- Copyright
- 2009 Petr Skoda (skodak)
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
webservice_rest_server::__construct |
( |
| $authmethod | ) |
|
Contructor.
- Parameters
-
string | $authmethod | authentication method of the web service (WEBSERVICE_AUTHMETHOD_PERMANENT_TOKEN, ...) |
string | $restformat | Format of the return values: 'xml' or 'json' |
◆ generate_error()
webservice_rest_server::generate_error |
( |
| $ex | ) |
|
|
protected |
Build the error information matching the REST returned value format (JSON or XML)
- Parameters
-
exception | $ex | the exception we are converting in the server rest format |
- Return values
-
string | the error in the requested REST format |
◆ send_error()
webservice_rest_server::send_error |
( |
| $ex = null | ) |
|
|
protected |
Send the error information to the WS client formatted as XML document.
Note: the exception is never passed as null, it only matches the abstract function declaration.
- Parameters
-
exception | $ex | the exception that we are sending |
◆ xmlize_result()
static webservice_rest_server::xmlize_result |
( |
| $returns, |
|
|
| $desc ) |
|
staticprotected |
Internal implementation - recursive function producing XML markup.
- Parameters
-
mixed | $returns | the returned values |
external_description | $desc | |
- Return values
-
The documentation for this class was generated from the following file:
- webservice/rest/locallib.php