Definition at line 44 of file Server.php.
◆ __construct()
__construct |
( |
|
$wsdl = null , |
|
|
array |
$options = null |
|
) |
| |
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().
- Parameters
-
string | $wsdl | |
array | $options | |
- Returns
- void
Definition at line 172 of file Server.php.
174 if (!extension_loaded(
'soap')) {
175 #require_once 'Zend/Soap/Server/Exception.php'; 179 if (
null !== $wsdl) {
◆ _getSoap()
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.
- Returns
- SoapServer
Definition at line 811 of file Server.php.
814 $server =
new SoapServer($this->_wsdl,
$options);
816 if (!empty($this->_functions)) {
817 $server->addFunction($this->_functions);
820 if (!empty($this->_class)) {
822 array_unshift($args, $this->_class);
823 if ($this->_wsiCompliant) {
824 #require_once 'Zend/Soap/Server/Proxy.php'; 825 array_unshift($args,
'Zend_Soap_Server_Proxy');
827 call_user_func_array(array($server,
'setClass'), $args);
830 if (!empty($this->_object)) {
831 $server->setObject($this->_object);
834 if (
null !== $this->_persistence) {
835 $server->setPersistence($this->_persistence);
◆ _initializeSoapErrorContext()
_initializeSoapErrorContext |
( |
| ) |
|
|
protected |
Method initalizes the error context that the SOAPServer enviroment will run in.
- Returns
- boolean display_errors original value
Definition at line 918 of file Server.php.
920 $displayErrorsOriginalState =
ini_get(
'display_errors');
921 ini_set(
'display_errors',
false);
922 set_error_handler(array($this,
'handlePhpErrors'), E_USER_ERROR);
923 return $displayErrorsOriginalState;
ini_set($varName, $newValue)
◆ _setRequest()
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
- Parameters
-
DOMDocument | DOMNode | SimpleXMLElement | stdClass | string | $request | |
- Returns
- Zend_Soap_Server
Definition at line 723 of file Server.php.
725 if (
$request instanceof DOMDocument) {
728 $xml =
$request->ownerDocument->saveXML();
738 $dom =
new DOMDocument();
741 #require_once 'Zend/Soap/Server/Exception.php'; 745 #require_once 'Zend/Soap/Server/Exception.php'; 751 $this->_request = $xml;
elseif(isset( $params[ 'redirect_parent']))
static scan($xml, DOMDocument $dom=null)
◆ addFunction()
addFunction |
( |
|
$function, |
|
|
|
$namespace = '' |
|
) |
| |
Attach a function as a server method
- Parameters
-
array | string | $function | Function name, array of function names to attach, or SOAP_FUNCTIONS_ALL to attach all functions |
string | $namespace | Ignored |
- Returns
- Zend_Soap_Server
- Exceptions
-
Implements Zend_Server_Interface.
Definition at line 545 of file Server.php.
548 if ($this->_functions == SOAP_FUNCTIONS_ALL) {
552 if (is_array($function)) {
553 foreach ($function as $func) {
555 $this->_functions[] = $func;
557 #require_once 'Zend/Soap/Server/Exception.php'; 561 $this->_functions = array_merge($this->_functions, $function);
563 $this->_functions[] = $function;
564 }
elseif ($function == SOAP_FUNCTIONS_ALL) {
565 $this->_functions = SOAP_FUNCTIONS_ALL;
567 #require_once 'Zend/Soap/Server/Exception.php'; 571 if (is_array($this->_functions)) {
572 $this->_functions = array_unique($this->_functions);
elseif(isset( $params[ 'redirect_parent']))
◆ deregisterFaultException()
deregisterFaultException |
( |
|
$class | ) |
|
Deregister a fault exception from the fault exception stack
- Parameters
-
- Returns
- boolean
Definition at line 944 of file Server.php.
946 if (in_array(
$class, $this->_faultExceptions,
true)) {
948 unset($this->_faultExceptions[
$index]);
$_option $_optionId $class
◆ fault()
fault |
( |
|
$fault = null , |
|
|
|
$code = "Receiver" |
|
) |
| |
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()}.
string|Exception $fault string $code SOAP Fault Codes SoapFault
Implements Zend_Server_Interface.
Definition at line 979 of file Server.php.
981 if ($fault instanceof Exception) {
982 $class = get_class($fault);
983 if (in_array(
$class, $this->_faultExceptions)) {
985 $eCode = $fault->getCode();
990 }
elseif(is_string($fault)) {
996 $allowedFaultModes = array(
997 'VersionMismatch',
'MustUnderstand',
'DataEncodingUnknown',
998 'Sender',
'Receiver',
'Server' 1000 if(!in_array(
$code, $allowedFaultModes)) {
elseif(isset( $params[ 'redirect_parent']))
$_option $_optionId $class
◆ getActor()
Retrieve actor
- Returns
- string
Definition at line 401 of file Server.php.
◆ getClassmap()
Retrieve classmap
- Returns
- mixed
Definition at line 467 of file Server.php.
◆ getEncoding()
Get encoding
- Returns
- string
Definition at line 330 of file Server.php.
◆ getFaultExceptions()
Return fault exceptions list
- Returns
- array
Definition at line 960 of file Server.php.
◆ getFunctions()
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).
@access public
- Returns
- array
Implements Zend_Server_Interface.
Definition at line 658 of file Server.php.
660 $functions = array();
661 if (
null !== $this->_class) {
662 $functions = get_class_methods($this->_class);
663 }
elseif (
null !== $this->_object) {
664 $functions = get_class_methods($this->_object);
667 return array_merge((array) $this->_functions, $functions);
elseif(isset( $params[ 'redirect_parent']))
◆ getLastRequest()
Retrieve request XML
- Returns
- string
Definition at line 760 of file Server.php.
◆ getLastResponse()
Get response XML
- Returns
- string
Definition at line 797 of file Server.php.
◆ getOptions()
Return array of options suitable for using with SoapServer constructor
- Returns
- array
Definition at line 248 of file Server.php.
251 if (
null !== $this->_actor) {
255 if (
null !== $this->_classmap) {
259 if (
null !== $this->_encoding) {
263 if (
null !== $this->_soapVersion) {
267 if (
null !== $this->_uri) {
271 if (
null !== $this->_features) {
275 if (
null !== $this->_wsdlCache) {
279 if (
null !== $this->_wsiCompliant) {
◆ getPersistence()
◆ getReturnResponse()
Retrieve return response flag
- Returns
- boolean
Definition at line 787 of file Server.php.
◆ getSoapFeatures()
Return current SOAP Features options
- Returns
- int
Definition at line 511 of file Server.php.
◆ getSoapVersion()
Get SOAP version
- Returns
- int
Definition at line 358 of file Server.php.
◆ getUri()
Retrieve URI
- Returns
- string
Definition at line 427 of file Server.php.
◆ getWsdl()
Retrieve wsdl
- Returns
- string
Definition at line 489 of file Server.php.
◆ getWsdlCache()
Get current SOAP Wsdl Caching option
Definition at line 531 of file Server.php.
◆ getWsiCompliant()
Gt WS-I compliant
- Returns
- boolean
Definition at line 303 of file Server.php.
◆ handle()
handle |
( |
|
$request = null | ) |
|
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).
- Parameters
-
DOMDocument | DOMNode | SimpleXMLElement | stdClass | string | $request | Optional request |
- Returns
- void|string
- See also
- Zend_Soap_Server_Exception
Implements Zend_Server_Interface.
Definition at line 860 of file Server.php.
869 $setRequestException =
null;
873 #require_once 'Zend/Soap/Server/Exception.php'; 877 $setRequestException = $e;
884 if ($setRequestException instanceof Exception) {
886 $fault = $this->
fault($setRequestException->getMessage(),
'Sender');
889 $soap->handle($this->_request);
890 }
catch (Exception $e) {
891 $fault = $this->
fault($e);
894 $this->_response = ob_get_clean();
897 restore_error_handler();
898 ini_set(
'display_errors', $displayErrorsOriginalState);
902 $soap->fault($fault->faultcode, $fault->faultstring);
905 if (!$this->_returnResponse) {
ini_set($varName, $newValue)
fault($fault=null, $code="Receiver")
_initializeSoapErrorContext()
◆ handlePhpErrors()
handlePhpErrors |
( |
|
$errno, |
|
|
|
$errstr, |
|
|
|
$errfile = null , |
|
|
|
$errline = null , |
|
|
array |
$errcontext = null |
|
) |
| |
Throw PHP errors as SoapFaults
- Parameters
-
int | $errno | |
string | $errstr | |
string | $errfile | |
int | $errline | |
array | $errcontext | |
- Returns
- void
- Exceptions
-
Definition at line 1018 of file Server.php.
1020 throw $this->
fault($errstr,
"Receiver");
fault($fault=null, $code="Receiver")
◆ loadFunctions()
loadFunctions |
( |
|
$definition | ) |
|
Unimplemented: Load server definition
- Parameters
-
- Returns
- void
- Exceptions
-
Implements Zend_Server_Interface.
Definition at line 677 of file Server.php.
679 #require_once 'Zend/Soap/Server/Exception.php';
◆ registerFaultException()
registerFaultException |
( |
|
$class | ) |
|
Register a valid fault exception
- Parameters
-
string | array | $class | Exception class or array of exception classes |
- Returns
- Zend_Soap_Server
Definition at line 932 of file Server.php.
934 $this->_faultExceptions = array_merge($this->_faultExceptions, (array)
$class);
$_option $_optionId $class
◆ setActor()
Set actor
Actor is the actor URI for the server.
- Parameters
-
- Returns
- Zend_Soap_Server
Definition at line 389 of file Server.php.
392 $this->_actor = $actor;
◆ setClass()
setClass |
( |
|
$class, |
|
|
|
$namespace = '' , |
|
|
|
$argv = null |
|
) |
| |
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.
- Parameters
-
string | $class | Class Name which executes SOAP Requests at endpoint. |
- Returns
- Zend_Soap_Server
- Exceptions
-
Implements Zend_Server_Interface.
Definition at line 591 of file Server.php.
593 if (isset($this->_class)) {
594 #require_once 'Zend/Soap/Server/Exception.php'; 599 #require_once 'Zend/Soap/Server/Exception.php'; 604 #require_once 'Zend/Soap/Server/Exception.php'; 609 if (1 < func_num_args()) {
610 $argv = func_get_args();
612 $this->_classArgs = $argv;
$_option $_optionId $class
◆ setClassmap()
◆ setEncoding()
Set encoding
- Parameters
-
- Returns
- Zend_Soap_Server
- Exceptions
-
Definition at line 314 of file Server.php.
316 if (!is_string($encoding)) {
317 #require_once 'Zend/Soap/Server/Exception.php'; 321 $this->_encoding = $encoding;
◆ setObject()
Attach an object to a server
Accepts an instanciated object to use when handling requests.
- Parameters
-
- Returns
- Zend_Soap_Server
Definition at line 626 of file Server.php.
628 if(!is_object($object)) {
629 #require_once 'Zend/Soap/Server/Exception.php'; 633 if(isset($this->_object)) {
634 #require_once 'Zend/Soap/Server/Exception.php'; 638 if ($this->_wsiCompliant) {
639 #require_once 'Zend/Soap/Server/Proxy.php'; 642 $this->_object = $object;
◆ setOptions()
Set Options
Allows setting options as an associative array of option => value pairs.
- Parameters
-
- Returns
- Zend_Soap_Server
Definition at line 196 of file Server.php.
225 trigger_error(__METHOD__ .
': the option "featues" is deprecated as of 1.10.x and will be removed with 2.0.0; use "features" instead', E_USER_NOTICE);
232 case 'wsi_compliant':
setSoapFeatures($feature)
◆ setPersistence()
Set server persistence
- Parameters
-
- Returns
- Zend_Soap_Server
Implements Zend_Server_Interface.
Definition at line 689 of file Server.php.
691 if (!in_array(
$mode, array(SOAP_PERSISTENCE_SESSION, SOAP_PERSISTENCE_REQUEST))) {
692 #require_once 'Zend/Soap/Server/Exception.php'; 696 $this->_persistence =
$mode;
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
◆ setReturnResponse()
setReturnResponse |
( |
|
$flag | ) |
|
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().
- Parameters
-
- Returns
- Zend_Soap_Server
Definition at line 776 of file Server.php.
778 $this->_returnResponse = ($flag) ?
true :
false;
◆ setSoapFeatures()
setSoapFeatures |
( |
|
$feature | ) |
|
◆ setSoapVersion()
setSoapVersion |
( |
|
$version | ) |
|
Set SOAP version
- Parameters
-
int | $version | One of the SOAP_1_1 or SOAP_1_2 constants |
- Returns
- Zend_Soap_Server
- Exceptions
-
Definition at line 342 of file Server.php.
344 if (!in_array(
$version, array(SOAP_1_1, SOAP_1_2))) {
345 #require_once 'Zend/Soap/Server/Exception.php';
◆ setUri()
Set URI
URI in SoapServer is actually the target namespace, not a URI; $uri must begin with 'urn:'.
- Parameters
-
- Returns
- Zend_Soap_Server
- Exceptions
-
Definition at line 415 of file Server.php.
◆ setWsdl()
Set wsdl
- Parameters
-
string | $wsdl | URI or path to a WSDL |
- Returns
- Zend_Soap_Server
Definition at line 478 of file Server.php.
480 $this->_wsdl = $wsdl;
◆ setWsdlCache()
◆ setWsiCompliant()
setWsiCompliant |
( |
|
$value | ) |
|
◆ validateUrn()
Check for valid URN
- Parameters
-
- Returns
- true
- Exceptions
-
Definition at line 370 of file Server.php.
372 $scheme = parse_url($urn, PHP_URL_SCHEME);
373 if ($scheme ===
false || $scheme ===
null) {
374 #require_once 'Zend/Soap/Server/Exception.php';
◆ $_actor
◆ $_class
◆ $_classArgs
◆ $_classmap
◆ $_encoding
◆ $_faultExceptions
$_faultExceptions = array() |
|
protected |
◆ $_features
◆ $_functions
◆ $_object
Object registered with this server
Definition at line 67 of file Server.php.
◆ $_persistence
◆ $_request
◆ $_response
◆ $_returnResponse
◆ $_soapVersion
◆ $_uri
◆ $_wsdl
◆ $_wsdlCache
◆ $_wsiCompliant
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Soap/Server.php