Soap/Server.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Soap
- Subpackage
- Server
\Zend_Soap_Server
Zend_Soap_Server
- Implements
- \Zend_Server_Interface
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Uses
- \global\Zend_Server_Interface
- Version
- $Id: Server.php 25177 2012-12-22 20:54:18Z rob $
Properties


array $_classArgs = array()
Arguments to pass to {@link $_class} constructor
array()
Details- Type
- array


array $_classmap =
Array of SOAP type => PHP class pairings for handling return/incoming values
- Type
- array


array $_faultExceptions = array()
Registered fault exceptions
array()
Details- Type
- array


array|int $_functions = array()
Functions registered with this server; may be either an array or the SOAP_FUNCTIONS_ALL constant
array()
Details- Type
- array | int


int $_persistence =
Persistence mode; should be one of the SOAP persistence constants
- Type
- int


boolean $_returnResponse = false
Flag: whether or not {@link handle()} should return a response instead of automatically emitting it.
false
Details- Type
- boolean


int $_soapVersion = SOAP_1_2
SOAP version to use; SOAP_1_2 by default, to allow processing of headers
SOAP_1_2
Details- Type
- int
Methods


__construct(string $wsdl = null, array $options = null) : void
Constructor
Sets display_errors INI setting to off (prevent client errors due to bad XML in response). Registers handlePhpErrors() as error handler for E_USER_ERROR.
If $wsdl is provided, it is passed on to setWsdl(); if any options are specified, they are passed on to setOptions().
Name | Type | Description |
---|---|---|
$wsdl | string | |
$options | array |


_getSoap() : \SoapServer
Get SoapServer object
Uses $_wsdl and return value of getOptions() to instantiate SoapServer object, and then registers any functions or class with it, as well as peristence.
Type | Description |
---|---|
\SoapServer |


_initializeSoapErrorContext() : boolean
Method initalizes the error context that the SOAPServer enviroment will run in.
Type | Description |
---|---|
boolean | display_errors original value |


_setRequest(\DOMDocument | \DOMNode | \SimpleXMLElement | \stdClass | string $request) : \Zend_Soap_Server
Set request
$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
Name | Type | Description |
---|---|---|
$request | \DOMDocument | \DOMNode | \SimpleXMLElement | \stdClass | string |
Type | Description |
---|---|
\Zend_Soap_Server |


addFunction(array | string $function, string $namespace = '') : \Zend_Soap_Server
Attach a function as a server method
Namespacing is primarily for xmlrpc, but may be used with other implementations to prevent naming collisions.
Name | Type | Description |
---|---|---|
$function | array | string | Function name, array of function names to attach, or SOAP_FUNCTIONS_ALL to attach all functions |
$namespace | string | Ignored |
Type | Description |
---|---|
\Zend_Soap_Server |
Exception | Description |
---|---|
\Zend_Soap_Server_Exception | on invalid functions |


deregisterFaultException(string $class) : boolean
Deregister a fault exception from the fault exception stack
Name | Type | Description |
---|---|---|
$class | string |
Type | Description |
---|---|
boolean |


fault(string | \Exception $fault = null, string $code = "Receiver") : \SoapFault
Generate a server fault
Note that the arguments are reverse to those of SoapFault.
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()}.
Name | Type | Description |
---|---|---|
$fault | string | \Exception | |
$code | string | SOAP Fault Codes |
Type | Description |
---|---|
\SoapFault |


getFunctions() : array
Return a server definition array
Returns a list of all functions registered with addFunction(), merged with all public methods of the class set with setClass() (if any).
Type | Description |
---|---|
array |
- Access
- public


getOptions() : array
Return array of options suitable for using with SoapServer constructor
Type | Description |
---|---|
array |


getPersistence() : \Zend_Soap_Server
Get server persistence
Type | Description |
---|---|
\Zend_Soap_Server |


handle(\DOMDocument | \DOMNode | \SimpleXMLElement | \stdClass | string $request = null) : void | string
Handle a request
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).
Name | Type | Description |
---|---|---|
$request | \DOMDocument | \DOMNode | \SimpleXMLElement | \stdClass | string | Optional request |
Type | Description |
---|---|
void | string |


handlePhpErrors(int $errno, string $errstr, string $errfile = null, int $errline = null, array $errcontext = null) : void
Throw PHP errors as SoapFaults
Name | Type | Description |
---|---|---|
$errno | int | |
$errstr | string | |
$errfile | string | |
$errline | int | |
$errcontext | array |
Exception | Description |
---|---|
\SoapFault |


loadFunctions( $definition) : void
Unimplemented: Load server definition
Used for persistence; loads a construct as returned by getFunctions().
Name | Type | Description |
---|---|---|
$definition |
Exception | Description |
---|---|
\Zend_Soap_Server_Exception | Unimplemented |


registerFaultException(string | array $class) : \Zend_Soap_Server
Register a valid fault exception
Name | Type | Description |
---|---|---|
$class | string | array | Exception class or array of exception classes |
Type | Description |
---|---|
\Zend_Soap_Server |


setActor(string $actor) : \Zend_Soap_Server
Set actor
Actor is the actor URI for the server.
Name | Type | Description |
---|---|---|
$actor | string |
Type | Description |
---|---|
\Zend_Soap_Server |


setClass(string $class, $namespace = '', $argv = null) : \Zend_Soap_Server
Attach a class to a server
Accepts a class name to use when handling requests. Any additional arguments will be passed to that class' constructor when instantiated.
See setObject() to set preconfigured object instances as request handlers.
Name | Type | Description |
---|---|---|
$class | string | Class Name which executes SOAP Requests at endpoint. |
$namespace | ||
$argv |
Type | Description |
---|---|
\Zend_Soap_Server |
Exception | Description |
---|---|
\Zend_Soap_Server_Exception | if called more than once, or if class does not exist |


setClassmap(array $classmap) : \Zend_Soap_Server
Set classmap
Name | Type | Description |
---|---|---|
$classmap | array |
Type | Description |
---|---|
\Zend_Soap_Server |
Exception | Description |
---|---|
\Zend_Soap_Server_Exception | for any invalid class in the class map |


setEncoding(string $encoding) : \Zend_Soap_Server
Set encoding
Name | Type | Description |
---|---|---|
$encoding | string |
Type | Description |
---|---|
\Zend_Soap_Server |
Exception | Description |
---|---|
\Zend_Soap_Server_Exception | with invalid encoding argument |


setObject(object $object) : \Zend_Soap_Server
Attach an object to a server
Accepts an instanciated object to use when handling requests.
Name | Type | Description |
---|---|---|
$object | object |
Type | Description |
---|---|
\Zend_Soap_Server |


setOptions(array | \Zend_Config $options) : \Zend_Soap_Server
Set Options
Allows setting options as an associative array of option => value pairs.
Name | Type | Description |
---|---|---|
$options | array | \Zend_Config |
Type | Description |
---|---|
\Zend_Soap_Server |


setPersistence(int $mode) : \Zend_Soap_Server
Set server persistence
Name | Type | Description |
---|---|---|
$mode | int |
Type | Description |
---|---|
\Zend_Soap_Server |


setReturnResponse(boolean $flag) : \Zend_Soap_Server
Set return response flag
If true, handle() will return the response instead of automatically sending it back to the requesting client.
The response is always available via getResponse().
Name | Type | Description |
---|---|---|
$flag | boolean |
Type | Description |
---|---|
\Zend_Soap_Server |


setSoapFeatures(string | int $feature) : \Zend_Soap_Server
Set the SOAP Feature options.
Name | Type | Description |
---|---|---|
$feature | string | int |
Type | Description |
---|---|
\Zend_Soap_Server |


setSoapVersion(int $version) : \Zend_Soap_Server
Set SOAP version
Name | Type | Description |
---|---|---|
$version | int | One of the SOAP_1_1 or SOAP_1_2 constants |
Type | Description |
---|---|
\Zend_Soap_Server |
Exception | Description |
---|---|
\Zend_Soap_Server_Exception | with invalid soap version argument |


setUri(string $uri) : \Zend_Soap_Server
Set URI
URI in SoapServer is actually the target namespace, not a URI; $uri must begin with 'urn:'.
Name | Type | Description |
---|---|---|
$uri | string |
Type | Description |
---|---|
\Zend_Soap_Server |
Exception | Description |
---|---|
\Zend_Soap_Server_Exception | with invalid uri argument |


setWsdl(string $wsdl) : \Zend_Soap_Server
Set wsdl
Name | Type | Description |
---|---|---|
$wsdl | string | URI or path to a WSDL |
Type | Description |
---|---|
\Zend_Soap_Server |


setWsdlCache( $options) : \Zend_Soap_Server
Set the SOAP Wsdl Caching Options
Name | Type | Description |
---|---|---|
$options |
Type | Description |
---|---|
\Zend_Soap_Server |


setWsiCompliant(boolean $value) : \Zend_Soap_Server
Set WS-I compliant
Name | Type | Description |
---|---|---|
$value | boolean |
Type | Description |
---|---|
\Zend_Soap_Server |


validateUrn(string $urn) : true
Check for valid URN
Name | Type | Description |
---|---|---|
$urn | string |
Type | Description |
---|---|
true |
Exception | Description |
---|---|
\Zend_Soap_Server_Exception | on invalid URN |