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\self

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

\Zend\Soap\self

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 caught exception during business code execution

getException() : null | \Exception

Returns

null\Exceptioncaught exception

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

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() : int

Returns

int

Get response XML

getResponse() : string

Returns

string

Retrieve return response flag

getReturnResponse() : bool

Returns

bool

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

Return current SOAP Features options

getSoapFeatures() : int

Returns

int

Get SOAP version

getSoapVersion() : int

Returns

int

Retrieve typemap

getTypemap() : array

Returns

array

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) 

Parameters

$errno

int

$errstr

string

$errfile

string

$errline

int

$errcontext

array

Exceptions

\SoapFault

Checks if provided fault name is registered as valid in this server.

isRegisteredAsFaultException(string $fault) : bool

Parameters

$fault

string

Name of a fault class

Returns

bool

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

Validate and register fault exception

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

Parameters

$class

stringarray

Exception class or array of exception classes

Exceptions

\Zend\Soap\Exception\InvalidArgumentException

Returns

\Zend\Soap\self

Set actor

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

Actor is the actor URI for the server.

Parameters

$actor

string

Returns

\Zend\Soap\self

Attach a class to a server

setClass(string | object $class, string $namespace, null | array $argv) : \Zend\Soap\self

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 pre-configured object instances as request handlers.

Parameters

$class

stringobject

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

$namespace

string

$argv

nullarray

Exceptions

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

Returns

\Zend\Soap\self

Set classmap

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

Parameters

$classmap

array

Exceptions

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

Returns

\Zend\Soap\self

Set the debug mode.

setDebugMode(bool $debug) : \Zend\Soap\self

In debug mode, all exceptions are send to the client.

Parameters

$debug

bool

Returns

\Zend\Soap\self

Set encoding

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

Parameters

$encoding

string

Exceptions

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

Returns

\Zend\Soap\self

Attach an object to a server

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

Accepts an instantiated object to use when handling requests.

Parameters

$object

object

Exceptions

\Zend\Soap\Exception\InvalidArgumentException

Returns

\Zend\Soap\self

Set Options

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

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

Parameters

$options

array\Traversable

Returns

\Zend\Soap\self

Set server persistence

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

Parameters

$mode

int

SOAP_PERSISTENCE_SESSION or SOAP_PERSISTENCE_REQUEST constants

Exceptions

\Zend\Soap\Exception\InvalidArgumentException

Returns

\Zend\Soap\self

Set return response flag

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

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

\Zend\Soap\self

Set the SOAP Feature options.

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

Parameters

$feature

stringint

Returns

\Zend\Soap\self

Set SOAP version

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

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

\Zend\Soap\self

Set typemap with xml to php type mappings with appropriate validation.

setTypemap(array $typeMap) : \Zend\Soap\self

Parameters

$typeMap

array

Exceptions

\Zend\Soap\Exception\InvalidArgumentException

Returns

\Zend\Soap\self

Set URI

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

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

Parameters

$uri

string

Returns

\Zend\Soap\self

Set wsdl

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

Parameters

$wsdl

string

URI or path to a WSDL

Returns

\Zend\Soap\self

Set the SOAP WSDL Caching Options

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

Parameters

$options

stringintbool

Returns

\Zend\Soap\self

Check for valid URN

validateUrn(string $urn) : true

Parameters

$urn

string

Exceptions

\Zend\Soap\Exception\InvalidArgumentException on invalid URN

Returns

true

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\self

$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

\Zend\Soap\self

 Properties

 

Actor URI

$actor : string

 

Container for caught exception during business code execution

$caughtException : \Exception

 

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

 

Informs if the soap server is in debug mode

$debug : bool

 

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

 

Server instance

$server : \SoapServer

 

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

$soapVersion : int

 

Array of type mappings

$typemap : array

 

URI namespace for SOAP server

$uri : string

 

URI or path to WSDL

$wsdl : string

 

WSDL Caching Options of SOAP Server

$wsdlCache : mixed