[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/webservice/soap/ -> locallib.php (summary)

SOAP web service implementation classes and methods.

Copyright: 2009 Petr Skodak
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 327 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

moodle_zend_soap_server:: (2 methods):
  fault()
  handle()

webservice_soap_server:: (5 methods):
  __construct()
  init_zend_server()
  parse_request()
  send_error()
  generate_simple_struct_class()

webservice_soap_test_client:: (1 method):
  simpletest()


Class: moodle_zend_soap_server  - X-Ref

The Zend XMLRPC server but with a fault that returns debuginfo

fault($fault = null, $code = "Receiver")   X-Ref
Generate a server fault

Note that the arguments are the reverse of those used by SoapFault.

Moodle note: basically we return the faultactor (errorcode) and faultdetails (debuginfo)

If an exception is passed as the first argument, its message and code
will be used to create the fault object if it has been registered via
{@Link registerFaultException()}.

param: string|Exception $fault
param: string $code SOAP Fault Codes
return: SoapFault

handle($request = null)   X-Ref
Handle a request

NOTE: this is basically a copy of the Zend handle()
but with $soap->fault returning faultactor + faultdetail
So we don't require coding style checks within this method
to keep it as similar as the original one.

Instantiates SoapServer object with options set in object, and
dispatches its handle() method.

$request may be any of:
- DOMDocument; if so, then cast to XML
- DOMNode; if so, then grab owner document and cast to XML
- SimpleXMLElement; if so, then cast to XML
- stdClass; if so, calls __toString() and verifies XML
- string; if so, verifies XML

If no request is passed, pulls request using php:://input (for
cross-platform compatability purposes).

param: DOMDocument|DOMNode|SimpleXMLElement|stdClass|string $request Optional request
return: void|string

Class: webservice_soap_server  - X-Ref

SOAP service server implementation.

__construct($authmethod)   X-Ref
Contructor

param: string $authmethod authentication method of the web service (WEBSERVICE_AUTHMETHOD_PERMANENT_TOKEN, ...)

init_zend_server()   X-Ref
Set up zend service class


parse_request()   X-Ref
This method parses the $_POST and $_GET superglobals and looks for
the following information:
user authentication - username+password or token (wsusername, wspassword and wstoken parameters)


send_error($ex=null)   X-Ref
Send the error information to the WS client
formatted as an XML document.

param: exception $ex the exception to send back

generate_simple_struct_class(external_single_structure $structdesc)   X-Ref
Generate 'struct' type name
This type name is the name of a class generated on the fly.

param: external_single_structure $structdesc
return: string

Class: webservice_soap_test_client  - X-Ref

SOAP test client class

simpletest($serverurl, $function, $params)   X-Ref
Execute test client WS request

param: string $serverurl server url (including token parameter or username/password parameters)
param: string $function function name
param: array $params parameters of the called function
return: mixed



Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1