Zend_Soap_Server

category Zend
package Zend_Soap
subpackage Server

 Methods

Constructor

__construct(string $wsdl, array $options) 

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().

Parameters

$wsdl

string

$options

array

Exceptions

\Zend\Soap\Exception\ExtensionNotLoadedException

Attach a function as a server method

addFunction(array | string $function, string $namespace) : \Zend\Soap\Server

Namespacing is primarily for xmlrpc, but may be used with other implementations to prevent naming collisions.

Parameters

$function

arraystring

Function name, array of function names to attach, or SOAP_FUNCTIONS_ALL to attach all functions

$namespace

string

Ignored

Exceptions

\Zend\Soap\Exception\InvalidArgumentException on invalid functions

Returns

Deregister a fault exception from the fault exception stack

deregisterFaultException(string $class) : bool

Parameters

$class

string

Returns

bool

Generate a server fault

fault(string | \Exception $fault, string $code) : \SoapFault

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()}.

link http://www.w3.org/TR/soap12-part1/#faultcodes

Parameters

$fault

string\Exception

$code

string

SOAP Fault Codes

Returns

Retrieve actor

getActor() : string

Returns

string

Retrieve classmap

getClassmap() : mixed

Returns

mixed

Get encoding

getEncoding() : string

Returns

string

Return fault exceptions list

getFaultExceptions() : array

Returns

array

Return a server definition array

getFunctions() : array

Returns a list of all functions registered with addFunction(), merged with all public methods of the class set with setClass() (if any).

access public

Returns

array

Retrieve request XML

getLastRequest() : string

Returns

string

Return array of options suitable for using with SoapServer constructor

getOptions() : array

Returns

array

Get server persistence

getPersistence() : \Zend\Soap\Server

Get response XML

getResponse() : string

Returns

string

Retrieve return response flag

getReturnResponse() : bool

Returns

bool

Return current SOAP Features options

getSoapFeatures() : int

Returns

int

Get SOAP version

getSoapVersion() : int

Returns

int

Retrieve URI

getUri() : string

Returns

string

Retrieve wsdl

getWSDL() : string

Returns

string

Get current SOAP WSDL Caching option

getWSDLCache() 

Handle a request

handle(\DOMDocument | \DOMNode | \SimpleXMLElement | \stdClass | string $request) : void | string

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 compatibility purposes).

Parameters

$request

\DOMDocument\DOMNode\SimpleXMLElement\stdClassstring

Optional request

Returns

voidstring

Throw PHP errors as SoapFaults

handlePhpErrors(int $errno, string $errstr, string $errfile, int $errline, array $errcontext) : void

Parameters

$errno

int

$errstr

string

$errfile

string

$errline

int

$errcontext

array

Exceptions

\SoapFault

Unimplemented: Load server definition

loadFunctions(array $definition) : void

Used for persistence; loads a construct as returned by getFunctions().

Parameters

$definition

array

Exceptions

\Zend\Soap\Exception\RuntimeException Unimplemented

Register a valid fault exception

registerFaultException(string | array $class) : \Zend\Soap\Server

Parameters

$class

stringarray

Exception class or array of exception classes

Returns

Set actor

setActor(string $actor) : \Zend\Soap\Server

Actor is the actor URI for the server.

Parameters

$actor

string

Returns

Attach a class to a server

setClass(string | object $class, string $namespace, $argv) : \Zend\Soap\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.

Parameters

$class

stringobject

Class name or object instance which executes SOAP Requests at endpoint.

$namespace

string

$argv

Exceptions

\Zend\Soap\Exception\InvalidArgumentException if called more than once, or if class does not exist

Returns

Set classmap

setClassmap(array $classmap) : \Zend\Soap\Server

Parameters

$classmap

array

Exceptions

\Zend\Soap\Exception\InvalidArgumentException for any invalid class in the class map

Returns

Set encoding

setEncoding(string $encoding) : \Zend\Soap\Server

Parameters

$encoding

string

Exceptions

\Zend\Soap\Exception\InvalidArgumentException with invalid encoding argument

Returns

Attach an object to a server

setObject(object $object) : \Zend\Soap\Server

Accepts an instanciated object to use when handling requests.

Parameters

$object

object

Exceptions

\Zend\Soap\Exception\InvalidArgumentException

Returns

Set Options

setOptions(array | \Traversable $options) : \Zend\Soap\Server

Allows setting options as an associative array of option => value pairs.

Parameters

$options

array\Traversable

Returns

Set server persistence

setPersistence(int $mode) : \Zend\Soap\Server

Parameters

$mode

int

Exceptions

\Zend\Soap\Exception\InvalidArgumentException

Returns

Set return response flag

setReturnResponse(bool $flag) : \Zend\Soap\Server

If true, handle() will return the response instead of automatically sending it back to the requesting client.

The response is always available via getResponse().

Parameters

$flag

bool

Returns

Set the SOAP Feature options.

setSoapFeatures(string | int $feature) : \Zend\Soap\Server

Parameters

$feature

stringint

Returns

Set SOAP version

setSoapVersion(int $version) : \Zend\Soap\Server

Parameters

$version

int

One of the SOAP_1_1 or SOAP_1_2 constants

Exceptions

\Zend\Soap\Exception\InvalidArgumentException with invalid soap version argument

Returns

Set URI

setUri(string $uri) : \Zend\Soap\Server

URI in SoapServer is actually the target namespace, not a URI; $uri must begin with 'urn:'.

Parameters

$uri

string

Returns

Set wsdl

setWSDL(string $wsdl) : \Zend\Soap\Server

Parameters

$wsdl

string

URI or path to a WSDL

Returns

Set the SOAP WSDL Caching Options

setWSDLCache(string | int | bool $options) : \Zend\Soap\Server

Parameters

$options

stringintbool

Returns

Check for valid URN

validateUrn(string $urn) : true

Parameters

$urn

string

Exceptions

\Zend\Soap\Exception\InvalidArgumentException on invalid URN

Returns

true

Get SoapServer object

_getSoap() : \SoapServer

Uses $wsdl and return value of getOptions() to instantiate SoapServer object, and then registers any functions or class with it, as well as persistence.

Returns

Method initializes the error context that the SOAPServer environment will run in.

_initializeSoapErrorContext() : bool

Returns

booldisplay_errors original value

Set request

_setRequest(\DOMDocument | \DOMNode | \SimpleXMLElement | \stdClass | string $request) : \Zend\Soap\Server

$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

Parameters

Exceptions

\Zend\Soap\Exception\InvalidArgumentException

Returns

 Properties

 

Actor URI

$actor : string

 

Class registered with this server

$class : string

 

Arguments to pass to {@link $class} constructor

$classArgs : array

 

Array of SOAP type => PHP class pairings for handling return/incoming values

$classmap : array

 

Encoding

$encoding : string

 

Registered fault exceptions

$faultExceptions : array

 

SOAP Server Features

$features : int

 

Functions registered with this server; may be either an array or the SOAP_FUNCTIONS_ALL constant

$functions : array | int

 

Object registered with this server

$object 

 

Persistence mode; should be one of the SOAP persistence constants

$persistence : int

 

Request XML

$request : string

 

Response XML

$response : string

 

Flag: whether or not {@link handle()} should return a response instead of automatically emitting it.

$returnResponse : bool

 

SOAP version to use; SOAP_1_2 by default, to allow processing of headers

$soapVersion : int

 

URI namespace for SOAP server

$uri : string

 

URI or path to WSDL

$wsdl : string

 

WSDL Caching Options of SOAP Server

$wsdlCache : mixed