ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
nusoap_server Class Reference

nusoap_server allows the user to create a SOAP server that is capable of receiving messages and returning responses More...

+ Inheritance diagram for nusoap_server:
+ Collaboration diagram for nusoap_server:

Public Member Functions

 __construct ($wsdl=false)
 constructor the optional parameter is a path to a WSDL file that you'd like to bind the server instance to. More...
 
 service ($data)
 processes request and returns response More...
 
 parse_http_headers ()
 parses HTTP request headers. More...
 
 parse_request ($data='')
 parses a request More...
 
 invoke_method ()
 invokes a PHP function for the requested SOAP method More...
 
 serialize_return ()
 serializes the return value from a PHP function into a full SOAP Envelope More...
 
 send_response ()
 sends an HTTP response More...
 
 verify_method ($operation, $request)
 takes the value that was created by parsing the request and compares to the method's signature, if available. More...
 
 parseRequest ($headers, $data)
 processes SOAP message received from client More...
 
 getHTTPBody ($soapmsg)
 gets the HTTP body for the current response. More...
 
 getHTTPContentType ()
 gets the HTTP content type for the current response. More...
 
 getHTTPContentTypeCharset ()
 gets the HTTP content type charset for the current response. More...
 
 add_to_map ($methodname, $in, $out)
 add a method to the dispatch map (this has been replaced by the register method) More...
 
 register ($name, $in=array(), $out=array(), $namespace=false, $soapaction=false, $style=false, $use=false, $documentation='', $encodingStyle='')
 register a service function with the server More...
 
 fault ($faultcode, $faultstring, $faultactor='', $faultdetail='')
 Specify a fault to be returned to the client. More...
 
 configureWSDL ($serviceName, $namespace=false, $endpoint=false, $style='rpc', $transport='http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace=false)
 Sets up wsdl object. More...
 
- Public Member Functions inherited from nusoap_base
 __construct ()
 constructor More...
 
 getGlobalDebugLevel ()
 gets the global debug level, which applies to future instances More...
 
 setGlobalDebugLevel ($level)
 sets the global debug level, which applies to future instances More...
 
 getDebugLevel ()
 gets the debug level for this instance More...
 
 setDebugLevel ($level)
 sets the debug level for this instance More...
 
 debug ($string)
 adds debug data to the instance debug string with formatting More...
 
 appendDebug ($string)
 adds debug data to the instance debug string without formatting More...
 
 clearDebug ()
 clears the current debug data for this instance More...
 
getDebug ()
 gets the current debug data for this instance More...
 
getDebugAsXMLComment ()
 gets the current debug data for this instance as an XML comment this may change the contents of the debug data More...
 
 expandEntities ($val)
 expands entities, e.g. More...
 
 getError ()
 returns error string if present More...
 
 setError ($str)
 sets error string More...
 
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array) More...
 
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded', $soapval=false)
 serializes PHP values in accordance w/ section 5. More...
 
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded', $encodingStyle='http://schemas.xmlsoap.org/soap/encoding/')
 serializes a message More...
 
 formatDump ($str)
 formats a string to be inserted into an HTML stream More...
 
 contractQname ($qname)
 contracts (changes namespace to prefix) a qualified name More...
 
 expandQname ($qname)
 expands (changes prefix to namespace) a qualified name More...
 
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed More...
 
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed More...
 
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace More...
 
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace More...
 
 getmicrotime ()
 returns the time in ODBC canonical form with microseconds More...
 
 varDump ($data)
 Returns a string with the output of var_dump. More...
 
 __toString ()
 represents the object as a string More...
 

Data Fields

 $headers = array()
 
 $request = ''
 
 $requestHeaders = ''
 
 $requestHeader = null
 
 $document = ''
 
 $requestSOAP = ''
 
 $methodURI = ''
 
 $methodname = ''
 
 $methodparams = array()
 
 $SOAPAction = ''
 
 $xml_encoding = ''
 
 $decode_utf8 = true
 
 $outgoing_headers = array()
 
 $response = ''
 
 $responseHeaders = ''
 
 $responseSOAP = ''
 
 $methodreturn = false
 
 $methodreturnisliteralxml = false
 
 $fault = false
 
 $result = 'successful'
 
 $operations = array()
 
 $wsdl = false
 
 $externalWSDLURL = false
 
 $debug_flag = false
 
- Data Fields inherited from nusoap_base
 $title = 'NuSOAP'
 
 $version = '0.7.3'
 
 $revision = '$Revision$'
 
 $error_str = ''
 
 $debug_str = ''
 
 $charencoding = true
 
 $debugLevel
 
 $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 
 $soap_defencoding = 'UTF-8'
 
 $namespaces
 
 $usedNamespaces = array()
 
 $typemap
 
 $xmlEntities
 

Detailed Description

nusoap_server allows the user to create a SOAP server that is capable of receiving messages and returning responses

Author
Dietrich Ayala dietr.nosp@m.ich@.nosp@m.ganx4.nosp@m..com
Scott Nichol snich.nosp@m.ol@u.nosp@m.sers..nosp@m.sour.nosp@m.cefor.nosp@m.ge.n.nosp@m.et
Version
$Id$ public

Definition at line 3520 of file nusoap.php.

Constructor & Destructor Documentation

◆ __construct()

nusoap_server::__construct (   $wsdl = false)

constructor the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.

Parameters
mixed$wsdlfile path or URL (string), or wsdl instance (object) public

Definition at line 3678 of file nusoap.php.

References $_SERVER, ILIAS\MetaData\Repository\Validation\Data\__construct(), nusoap_base\appendDebug(), nusoap_base\clearDebug(), nusoap_base\debug(), nusoap_base\getDebug(), nusoap_base\getError(), and nusoap_base\varDump().

3679  {
3681  // turn on debugging?
3682  global $debug;
3683  global $HTTP_SERVER_VARS;
3684 
3685  if (isset($_SERVER)) {
3686  $this->debug("_SERVER is defined:");
3687  $this->appendDebug($this->varDump($_SERVER));
3688  } elseif (isset($HTTP_SERVER_VARS)) {
3689  $this->debug("HTTP_SERVER_VARS is defined:");
3690  $this->appendDebug($this->varDump($HTTP_SERVER_VARS));
3691  } else {
3692  $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
3693  }
3694 
3695  if (isset($debug)) {
3696  $this->debug("In nusoap_server, set debug_flag=$debug based on global flag");
3697  $this->debug_flag = $debug;
3698  } elseif (isset($_SERVER['QUERY_STRING'])) {
3699  $qs = explode('&', $_SERVER['QUERY_STRING']);
3700  foreach ($qs as $v) {
3701  if (substr($v, 0, 6) == 'debug=') {
3702  $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1");
3703  $this->debug_flag = substr($v, 6);
3704  }
3705  }
3706  } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
3707  $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']);
3708  foreach ($qs as $v) {
3709  if (substr($v, 0, 6) == 'debug=') {
3710  $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
3711  $this->debug_flag = substr($v, 6);
3712  }
3713  }
3714  }
3715 
3716  // wsdl
3717  if ($wsdl) {
3718  $this->debug("In nusoap_server, WSDL is specified");
3719  if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) {
3720  $this->wsdl = $wsdl;
3721  $this->externalWSDLURL = $this->wsdl->wsdl;
3722  $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
3723  } else {
3724  $this->debug('Create wsdl from ' . $wsdl);
3725  $this->wsdl = new wsdl($wsdl);
3726  $this->externalWSDLURL = $wsdl;
3727  }
3728  $this->appendDebug($this->wsdl->getDebug());
3729  $this->wsdl->clearDebug();
3730  if ($err = $this->wsdl->getError()) {
3731  die('WSDL ERROR: ' . $err);
3732  }
3733  }
3734  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:305
& getDebug()
gets the current debug data for this instance
Definition: nusoap.php:332
parses a WSDL file, allows access to it's data, other utility methods.
Definition: nusoap.php:4615
getError()
returns error string if present
Definition: nusoap.php:381
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
__construct(VocabulariesInterface $vocabularies)
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:909
clearDebug()
clears the current debug data for this instance
Definition: nusoap.php:319
+ Here is the call graph for this function:

Member Function Documentation

◆ add_to_map()

nusoap_server::add_to_map (   $methodname,
  $in,
  $out 
)

add a method to the dispatch map (this has been replaced by the register method)

Parameters
string$methodname
string$inarray of input values
string$outarray of output values public
Deprecated:

Definition at line 4414 of file nusoap.php.

References $out.

4415  {
4416  $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out);
4417  }
$out
Definition: buildRTE.php:24

◆ configureWSDL()

nusoap_server::configureWSDL (   $serviceName,
  $namespace = false,
  $endpoint = false,
  $style = 'rpc',
  $transport = 'http://schemas.xmlsoap.org/soap/http',
  $schemaTargetNamespace = false 
)

Sets up wsdl object.

Acts as a flag to enable internal WSDL generation

Parameters
string$serviceName,nameof the service
mixed$namespaceoptional 'tns' service namespace or false
mixed$endpointoptional URL of service endpoint or false
string$styleoptional (rpc|document) WSDL style (also specified by operation)
string$transportoptional SOAP transport
mixed$schemaTargetNamespaceoptional 'types' targetNamespace for service schema or false

Definition at line 4523 of file nusoap.php.

References $_SERVER, $namespace, $serviceName, and nusoap_base\setError().

4523  ://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false)
4524  {
4525  global $HTTP_SERVER_VARS;
4526 
4527  if (isset($_SERVER)) {
4528  $SERVER_NAME = $_SERVER['SERVER_NAME'];
4529  $SERVER_PORT = $_SERVER['SERVER_PORT'];
4530  $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
4531  $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
4532  } elseif (isset($HTTP_SERVER_VARS)) {
4533  $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
4534  $SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT'];
4535  $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
4536  $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
4537  } else {
4538  $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
4539  }
4540  // If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI)
4541  $colon = strpos($SERVER_NAME, ":");
4542  if ($colon) {
4543  $SERVER_NAME = substr($SERVER_NAME, 0, $colon);
4544  }
4545  if ($SERVER_PORT == 80) {
4546  $SERVER_PORT = '';
4547  } else {
4548  $SERVER_PORT = ':' . $SERVER_PORT;
4549  }
4550  if (false == $namespace) {
4551  $namespace = "http://$SERVER_NAME/soap/$serviceName";
4552  }
4553 
4554  if (false == $endpoint) {
4555  if ($HTTPS == '1' || $HTTPS == 'on') {
4556  $SCHEME = 'https';
4557  } else {
4558  $SCHEME = 'http';
4559  }
4560  $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME";
4561  }
4562 
4563  if (false == $schemaTargetNamespace) {
4564  $schemaTargetNamespace = $namespace;
4565  }
4566 
4567  $this->wsdl = new wsdl();
4568  $this->wsdl->serviceName = $serviceName;
4569  $this->wsdl->endpoint = $endpoint;
4570  $this->wsdl->namespaces['tns'] = $namespace;
4571  $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/';
4572  $this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/';
4573  if ($schemaTargetNamespace != $namespace) {
4574  $this->wsdl->namespaces['types'] = $schemaTargetNamespace;
4575  }
4576  $this->wsdl->schemas[$schemaTargetNamespace][0] = new nusoap_xmlschema('', '', $this->wsdl->namespaces);
4577  if ($style == 'document') {
4578  $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified';
4579  }
4580  $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace;
4581  $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array('location' => '', 'loaded' => true);
4582  $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array('location' => '', 'loaded' => true);
4583  $this->wsdl->bindings[$serviceName . 'Binding'] = array(
4584  'name'=>$serviceName . 'Binding',
4585  'style'=>$style,
4586  'transport'=>$transport,
4587  'portType'=>$serviceName . 'PortType');
4588  $this->wsdl->ports[$serviceName . 'Port'] = array(
4589  'binding'=>$serviceName . 'Binding',
4590  'location'=>$endpoint,
4591  'bindingType'=>'http://schemas.xmlsoap.org/wsdl/soap/');
4592  }
if($err=$client->getError()) $namespace
setError($str)
sets error string
Definition: nusoap.php:395
if(empty($path)) $serviceName
Definition: ltiservices.php:38
parses a WSDL file, allows access to it's data, other utility methods.
Definition: nusoap.php:4615
parses an XML Schema, allows access to it's data, other utility methods.
Definition: nusoap.php:1127
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
+ Here is the call graph for this function:

◆ fault()

nusoap_server::fault (   $faultcode,
  $faultstring,
  $faultactor = '',
  $faultdetail = '' 
)

Specify a fault to be returned to the client.

This also acts as a flag to the server that a fault has occured.

Parameters
string$faultcode
string$faultstring
string$faultactor
string$faultdetailpublic

Definition at line 4503 of file nusoap.php.

References nusoap_base\$soap_defencoding, and nusoap_base\getDebug().

4504  {
4505  if ($faultdetail == '' && $this->debug_flag) {
4506  $faultdetail = $this->getDebug();
4507  }
4508  $this->fault = new nusoap_fault($faultcode, $faultactor, $faultstring, $faultdetail);
4509  $this->fault->soap_defencoding = $this->soap_defencoding;
4510  }
Contains information for a SOAP fault.
Definition: nusoap.php:1035
& getDebug()
gets the current debug data for this instance
Definition: nusoap.php:332
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4503
$soap_defencoding
Definition: nusoap.php:164
+ Here is the call graph for this function:

◆ getHTTPBody()

nusoap_server::getHTTPBody (   $soapmsg)

gets the HTTP body for the current response.

Parameters
string$soapmsgThe SOAP payload
Returns
string The HTTP body, which includes the SOAP payload private

Definition at line 4373 of file nusoap.php.

4374  {
4375  return $soapmsg;
4376  }

◆ getHTTPContentType()

nusoap_server::getHTTPContentType ( )

gets the HTTP content type for the current response.

Note: getHTTPBody must be called before this.

Returns
string the HTTP content type for the current response. private

Definition at line 4386 of file nusoap.php.

4387  {
4388  return 'text/xml';
4389  }

◆ getHTTPContentTypeCharset()

nusoap_server::getHTTPContentTypeCharset ( )

gets the HTTP content type charset for the current response.

returns false for non-text content types.

Note: getHTTPBody must be called before this.

Returns
string the HTTP content type charset for the current response. private

Definition at line 4400 of file nusoap.php.

References nusoap_base\$soap_defencoding.

4401  {
4402  return $this->soap_defencoding;
4403  }
$soap_defencoding
Definition: nusoap.php:164

◆ invoke_method()

nusoap_server::invoke_method ( )

invokes a PHP function for the requested SOAP method

The following fields are set by this function (when successful)

methodreturn

Note that the PHP function that is called may also set the following fields to affect the response sent to the client

responseHeaders outgoing_headers

This sets the fault field on error

private

Definition at line 3982 of file nusoap.php.

References $param, nusoap_base\appendDebug(), nusoap_base\debug(), wsdl\getOperationData(), wsdl\getOperationDataForSoapAction(), and nusoap_base\varDump().

3983  {
3984  $this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction);
3985 
3986  if ($this->wsdl) {
3987  if ($this->opData = $this->wsdl->getOperationData($this->methodname)) {
3988  $this->debug('in invoke_method, found WSDL operation=' . $this->methodname);
3989  $this->appendDebug('opData=' . $this->varDump($this->opData));
3990  } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) {
3991  // Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element
3992  $this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']);
3993  $this->appendDebug('opData=' . $this->varDump($this->opData));
3994  $this->methodname = $this->opData['name'];
3995  } else {
3996  $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname);
3997  $this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service");
3998  return;
3999  }
4000  } else {
4001  $this->debug('in invoke_method, no WSDL to validate method');
4002  }
4003 
4004  // if a . is present in $this->methodname, we see if there is a class in scope,
4005  // which could be referred to. We will also distinguish between two deliminators,
4006  // to allow methods to be called a the class or an instance
4007  $class = '';
4008  $method = '';
4009  if (strpos($this->methodname, '..') > 0) {
4010  $delim = '..';
4011  } elseif (strpos($this->methodname, '.') > 0) {
4012  $delim = '.';
4013  } else {
4014  $delim = '';
4015  }
4016 
4017  if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1 &&
4018  class_exists(substr($this->methodname, 0, strpos($this->methodname, $delim)))) {
4019  // get the class and method name
4020  $class = substr($this->methodname, 0, strpos($this->methodname, $delim));
4021  $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
4022  $this->debug("in invoke_method, class=$class method=$method delim=$delim");
4023  }
4024  // set class handler
4025  // added to support single operations
4026  if ($class == '' && $this->class !='') {
4027  $class = $this->class;
4028  $delim = "..";
4029  $method = $this->methodname;
4030  }
4031 
4032  // does method exist?
4033  if ($class == '') {
4034  if (!function_exists($this->methodname)) {
4035  $this->debug("in invoke_method, function '$this->methodname' not found!");
4036  $this->result = 'fault: method not found';
4037  $this->fault('SOAP-ENV:Client', "method '$this->methodname' not defined in service");
4038  return;
4039  }
4040  } else {
4041  $method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method;
4042  if (!in_array($method_to_compare, get_class_methods($class))) {
4043  $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!");
4044  $this->result = 'fault: method not found';
4045  $this->fault('SOAP-ENV:Client', "method '$this->methodname' not defined in service");
4046  return;
4047  }
4048  }
4049 
4050  // evaluate message, getting back parameters
4051  // verify that request parameters match the method's signature
4052  if (! $this->verify_method($this->methodname, $this->methodparams)) {
4053  // debug
4054  $this->debug('ERROR: request not verified against method signature');
4055  $this->result = 'fault: request failed validation against method signature';
4056  // return fault
4057  $this->fault('SOAP-ENV:Client', "Operation '$this->methodname' not defined in service.");
4058  return;
4059  }
4060 
4061  // if there are parameters to pass
4062  $this->debug('in invoke_method, params:');
4063  $this->appendDebug($this->varDump($this->methodparams));
4064  $this->debug("in invoke_method, calling '$this->methodname'");
4065  if (!function_exists('call_user_func_array')) {
4066  if ($class == '') {
4067  $this->debug('in invoke_method, calling function using eval()');
4068  $funcCall = "\$this->methodreturn = $this->methodname(";
4069  } else {
4070  if ($delim == '..') {
4071  $this->debug('in invoke_method, calling class method using eval()');
4072  $funcCall = "\$this->methodreturn = " . $class . "::" . $method . "(";
4073  } else {
4074  $this->debug('in invoke_method, calling instance method using eval()');
4075  // generate unique instance name
4076  $instname = "\$inst_" . time();
4077  $funcCall = $instname . " = new " . $class . "(); ";
4078  $funcCall .= "\$this->methodreturn = " . $instname . "->" . $method . "(";
4079  }
4080  }
4081  if ($this->methodparams) {
4082  foreach ($this->methodparams as $param) {
4083  if (is_array($param) || is_object($param)) {
4084  $this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available');
4085  return;
4086  }
4087  $funcCall .= "\"$param\",";
4088  }
4089  $funcCall = substr($funcCall, 0, -1);
4090  }
4091  $funcCall .= ');';
4092  $this->debug('in invoke_method, function call: ' . $funcCall);
4093  @eval($funcCall);
4094  } else {
4095  if ($class == '') {
4096  $this->debug('in invoke_method, calling function using call_user_func_array()');
4097  $call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case after call_user_func_array()
4098  } elseif ($delim == '..') {
4099  $this->debug('in invoke_method, calling class method using call_user_func_array()');
4100  $call_arg = array($class, $method);
4101  } else {
4102  $this->debug('in invoke_method, calling instance method using call_user_func_array()');
4103  $instance = new $class();
4104  $call_arg = array(&$instance, $method);
4105  }
4106  if (is_array($this->methodparams)) {
4107  $this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams));
4108  } else {
4109  $this->methodreturn = call_user_func_array($call_arg, array());
4110  }
4111  }
4112  $this->debug('in invoke_method, methodreturn:');
4113  $this->appendDebug($this->varDump($this->methodreturn));
4114  $this->debug("in invoke_method, called method $this->methodname, received data of type " . gettype($this->methodreturn));
4115  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:305
parses a WSDL file, allows access to it's data, other utility methods.
Definition: nusoap.php:4615
getOperationDataForSoapAction($soapAction, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:5256
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4503
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
verify_method($operation, $request)
takes the value that was created by parsing the request and compares to the method's signature...
Definition: nusoap.php:4301
$param
Definition: xapitoken.php:46
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:909
getOperationData($operation, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:5224
+ Here is the call graph for this function:

◆ parse_http_headers()

nusoap_server::parse_http_headers ( )

parses HTTP request headers.

The following fields are set by this function (when successful)

headers request xml_encoding SOAPAction

private

Definition at line 3805 of file nusoap.php.

References $_SERVER, nusoap_base\debug(), and nusoap_base\setError().

3806  {
3807  global $HTTP_SERVER_VARS;
3808 
3809  $this->request = '';
3810  $this->SOAPAction = '';
3811  if (function_exists('getallheaders')) {
3812  $this->debug("In parse_http_headers, use getallheaders");
3813  $headers = getallheaders();
3814  foreach ($headers as $k=>$v) {
3815  $k = strtolower($k);
3816  $this->headers[$k] = $v;
3817  $this->request .= "$k: $v\r\n";
3818  $this->debug("$k: $v");
3819  }
3820  // get SOAPAction header
3821  if (isset($this->headers['soapaction'])) {
3822  $this->SOAPAction = str_replace('"', '', $this->headers['soapaction']);
3823  }
3824  // get the character encoding of the incoming request
3825  if (isset($this->headers['content-type']) && strpos($this->headers['content-type'], '=')) {
3826  $enc = str_replace('"', '', substr(strstr($this->headers["content-type"], '='), 1));
3827  if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
3828  $this->xml_encoding = strtoupper($enc);
3829  } else {
3830  $this->xml_encoding = 'US-ASCII';
3831  }
3832  } else {
3833  // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
3834  $this->xml_encoding = 'ISO-8859-1';
3835  }
3836  } elseif (isset($_SERVER) && is_array($_SERVER)) {
3837  $this->debug("In parse_http_headers, use _SERVER");
3838  foreach ($_SERVER as $k => $v) {
3839  if (substr($k, 0, 5) == 'HTTP_') {
3840  $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5))));
3841  } else {
3842  $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k)));
3843  }
3844  if ($k == 'soapaction') {
3845  // get SOAPAction header
3846  $k = 'SOAPAction';
3847  $v = str_replace('"', '', $v);
3848  $v = str_replace('\\', '', $v);
3849  $this->SOAPAction = $v;
3850  } elseif ($k == 'content-type') {
3851  // get the character encoding of the incoming request
3852  if (strpos($v, '=')) {
3853  $enc = substr(strstr($v, '='), 1);
3854  $enc = str_replace('"', '', $enc);
3855  $enc = str_replace('\\', '', $enc);
3856  if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
3857  $this->xml_encoding = strtoupper($enc);
3858  } else {
3859  $this->xml_encoding = 'US-ASCII';
3860  }
3861  } else {
3862  // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
3863  $this->xml_encoding = 'ISO-8859-1';
3864  }
3865  }
3866  $this->headers[$k] = $v;
3867  $this->request .= "$k: $v\r\n";
3868  $this->debug("$k: $v");
3869  }
3870  } elseif (is_array($HTTP_SERVER_VARS)) {
3871  $this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
3872  foreach ($HTTP_SERVER_VARS as $k => $v) {
3873  if (substr($k, 0, 5) == 'HTTP_') {
3874  $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5))));
3875  $k = strtolower(substr($k, 5));
3876  } else {
3877  $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k)));
3878  $k = strtolower($k);
3879  }
3880  if ($k == 'soapaction') {
3881  // get SOAPAction header
3882  $k = 'SOAPAction';
3883  $v = str_replace('"', '', $v);
3884  $v = str_replace('\\', '', $v);
3885  $this->SOAPAction = $v;
3886  } elseif ($k == 'content-type') {
3887  // get the character encoding of the incoming request
3888  if (strpos($v, '=')) {
3889  $enc = substr(strstr($v, '='), 1);
3890  $enc = str_replace('"', '', $enc);
3891  $enc = str_replace('\\', '', $enc);
3892  if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
3893  $this->xml_encoding = strtoupper($enc);
3894  } else {
3895  $this->xml_encoding = 'US-ASCII';
3896  }
3897  } else {
3898  // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
3899  $this->xml_encoding = 'ISO-8859-1';
3900  }
3901  }
3902  $this->headers[$k] = $v;
3903  $this->request .= "$k: $v\r\n";
3904  $this->debug("$k: $v");
3905  }
3906  } else {
3907  $this->debug("In parse_http_headers, HTTP headers not accessible");
3908  $this->setError("HTTP headers not accessible");
3909  }
3910  }
setError($str)
sets error string
Definition: nusoap.php:395
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
+ Here is the call graph for this function:

◆ parse_request()

nusoap_server::parse_request (   $data = '')

parses a request

The following fields are set by this function (when successful)

headers request xml_encoding SOAPAction request requestSOAP methodURI methodname methodparams requestHeaders document

This sets the fault field on error

Parameters
string$dataXML string private

Definition at line 3934 of file nusoap.php.

References $data, and nusoap_base\debug().

3935  {
3936  $this->debug('entering parse_request()');
3937  $this->parse_http_headers();
3938  $this->debug('got character encoding: ' . $this->xml_encoding);
3939  // uncompress if necessary
3940  if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') {
3941  $this->debug('got content encoding: ' . $this->headers['content-encoding']);
3942  if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') {
3943  // if decoding works, use it. else assume data wasn't gzencoded
3944  if (function_exists('gzuncompress')) {
3945  if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
3946  $data = $degzdata;
3947  } elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) {
3948  $data = $degzdata;
3949  } else {
3950  $this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data');
3951  return;
3952  }
3953  } else {
3954  $this->fault('SOAP-ENV:Client', 'This Server does not support compressed data');
3955  return;
3956  }
3957  }
3958  }
3959  $this->request .= "\r\n" . $data;
3960  $data = $this->parseRequest($this->headers, $data);
3961  $this->requestSOAP = $data;
3962  $this->debug('leaving parse_request');
3963  }
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4503
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
parseRequest($headers, $data)
processes SOAP message received from client
Definition: nusoap.php:4321
parse_http_headers()
parses HTTP request headers.
Definition: nusoap.php:3805
+ Here is the call graph for this function:

◆ parseRequest()

nusoap_server::parseRequest (   $headers,
  $data 
)

processes SOAP message received from client

Parameters
array$headersThe HTTP headers
string$dataunprocessed request data from client
Returns
mixed value of the message, decoded into a PHP type private

Definition at line 4321 of file nusoap.php.

References $data, nusoap_base\debug(), and nusoap_base\setError().

4322  {
4323  $this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' and type ' . $headers['content-type']);
4324  if (!strstr($headers['content-type'], 'text/xml')) {
4325  $this->setError('Request not of type text/xml');
4326  return false;
4327  }
4328  if (strpos($headers['content-type'], '=')) {
4329  $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
4330  $this->debug('Got response encoding: ' . $enc);
4331  if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
4332  $this->xml_encoding = strtoupper($enc);
4333  } else {
4334  $this->xml_encoding = 'US-ASCII';
4335  }
4336  } else {
4337  // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
4338  $this->xml_encoding = 'ISO-8859-1';
4339  }
4340  $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
4341  // parse response, get soap parser obj
4342  $parser = new nusoap_parser($data, $this->xml_encoding, '', $this->decode_utf8);
4343  // parser debug
4344  $this->debug("parser debug: \n" . $parser->getDebug());
4345  // if fault occurred during message parsing
4346  if ($err = $parser->getError()) {
4347  $this->result = 'fault: error in msg parsing: ' . $err;
4348  $this->fault('SOAP-ENV:Client', "error in msg parsing:\n" . $err);
4349  // else successfully parsed request into soapval object
4350  } else {
4351  // get/set methodname
4352  $this->methodURI = $parser->root_struct_namespace;
4353  $this->methodname = $parser->root_struct_name;
4354  $this->debug('methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);
4355  $this->debug('calling parser->get_soapbody()');
4356  $this->methodparams = $parser->get_soapbody();
4357  // get SOAP headers
4358  $this->requestHeaders = $parser->getHeaders();
4359  // get SOAP Header
4360  $this->requestHeader = $parser->get_soapheader();
4361  // add document for doclit support
4362  $this->document = $parser->document;
4363  }
4364  }
setError($str)
sets error string
Definition: nusoap.php:395
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4503
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
nusoap_parser class parses SOAP XML messages into native PHP values
Definition: nusoap.php:6543
+ Here is the call graph for this function:

◆ register()

nusoap_server::register (   $name,
  $in = array(),
  $out = array(),
  $namespace = false,
  $soapaction = false,
  $style = false,
  $use = false,
  $documentation = '',
  $encodingStyle = '' 
)

register a service function with the server

Parameters
string$namethe name of the PHP function, class.method or class..method
array$inassoc array of input values: key = param name, value = param type
array$outassoc array of output values: key = param name, value = param type
mixed$namespacethe element namespace for the method or false
mixed$soapactionthe soapaction for the method or false
mixed$styleoptional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically
mixed$useoptional (encoded|literal) or false
string$documentationoptional Description to include in WSDL
string$encodingStyleoptional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) public

Definition at line 4433 of file nusoap.php.

References $_SERVER, $namespace, $out, wsdl\addOperation(), and nusoap_base\setError().

4434  {
4435  global $HTTP_SERVER_VARS;
4436 
4437  if ($this->externalWSDLURL) {
4438  die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.');
4439  }
4440  if (! $name) {
4441  die('You must specify a name when you register an operation');
4442  }
4443  if (!is_array($in)) {
4444  die('You must provide an array for operation inputs');
4445  }
4446  if (!is_array($out)) {
4447  die('You must provide an array for operation outputs');
4448  }
4449  if (false == $namespace) {
4450  }
4451  if (false == $soapaction) {
4452  if (isset($_SERVER)) {
4453  $SERVER_NAME = $_SERVER['SERVER_NAME'];
4454  $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
4455  $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
4456  } elseif (isset($HTTP_SERVER_VARS)) {
4457  $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
4458  $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
4459  $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
4460  } else {
4461  $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
4462  }
4463  if ($HTTPS == '1' || $HTTPS == 'on') {
4464  $SCHEME = 'https';
4465  } else {
4466  $SCHEME = 'http';
4467  }
4468  $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name";
4469  }
4470  if (false == $style) {
4471  $style = "rpc";
4472  }
4473  if (false == $use) {
4474  $use = "encoded";
4475  }
4476  if ($use == 'encoded' && $encodingStyle = '') {
4477  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
4478  }
4479 
4480  $this->operations[$name] = array(
4481  'name' => $name,
4482  'in' => $in,
4483  'out' => $out,
4484  'namespace' => $namespace,
4485  'soapaction' => $soapaction,
4486  'style' => $style);
4487  if ($this->wsdl) {
4488  $this->wsdl->addOperation($name, $in, $out, $namespace, $soapaction, $style, $use, $documentation, $encodingStyle);
4489  }
4490  return true;
4491  }
if($err=$client->getError()) $namespace
setError($str)
sets error string
Definition: nusoap.php:395
parses a WSDL file, allows access to it's data, other utility methods.
Definition: nusoap.php:4615
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
$out
Definition: buildRTE.php:24
addOperation($name, $in=false, $out=false, $namespace=false, $soapaction=false, $style='rpc', $use='encoded', $documentation='', $encodingStyle='')
register an operation with the server
Definition: nusoap.php:6458
+ Here is the call graph for this function:

◆ send_response()

nusoap_server::send_response ( )

sends an HTTP response

The following fields are set by this function (when successful)

outgoing_headers response

private

Definition at line 4221 of file nusoap.php.

References $payload, nusoap_base\debug(), nusoap_base\getDebugAsXMLComment(), and ILIAS\UI\examples\Symbol\Glyph\Header\header().

4222  {
4223  $this->debug('Enter send_response');
4224  if ($this->fault) {
4225  $payload = $this->fault->serialize();
4226  $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error";
4227  $this->outgoing_headers[] = "Status: 500 Internal Server Error";
4228  } else {
4230  // Some combinations of PHP+Web server allow the Status
4231  // to come through as a header. Since OK is the default
4232  // just do nothing.
4233  // $this->outgoing_headers[] = "HTTP/1.0 200 OK";
4234  // $this->outgoing_headers[] = "Status: 200 OK";
4235  }
4236  // add debug data if in debug mode
4237  if (isset($this->debug_flag) && $this->debug_flag) {
4238  $payload .= $this->getDebugAsXMLComment();
4239  }
4240  $this->outgoing_headers[] = "Server: $this->title Server v$this->version";
4241  preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
4242  $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (" . $rev[1] . ")";
4243  // Let the Web server decide about this
4244  //$this->outgoing_headers[] = "Connection: Close\r\n";
4245  $payload = $this->getHTTPBody($payload);
4246  $type = $this->getHTTPContentType();
4247  $charset = $this->getHTTPContentTypeCharset();
4248  $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : '');
4249  //begin code to compress payload - by John
4250  // NOTE: there is no way to know whether the Web server will also compress
4251  // this data.
4252  if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {
4253  if (strstr($this->headers['accept-encoding'], 'gzip')) {
4254  if (function_exists('gzencode')) {
4255  if (isset($this->debug_flag) && $this->debug_flag) {
4256  $payload .= "<!-- Content being gzipped -->";
4257  }
4258  $this->outgoing_headers[] = "Content-Encoding: gzip";
4259  $payload = gzencode($payload);
4260  } else {
4261  if (isset($this->debug_flag) && $this->debug_flag) {
4262  $payload .= "<!-- Content will not be gzipped: no gzencode -->";
4263  }
4264  }
4265  } elseif (strstr($this->headers['accept-encoding'], 'deflate')) {
4266  // Note: MSIE requires gzdeflate output (no Zlib header and checksum),
4267  // instead of gzcompress output,
4268  // which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5)
4269  if (function_exists('gzdeflate')) {
4270  if (isset($this->debug_flag) && $this->debug_flag) {
4271  $payload .= "<!-- Content being deflated -->";
4272  }
4273  $this->outgoing_headers[] = "Content-Encoding: deflate";
4274  $payload = gzdeflate($payload);
4275  } else {
4276  if (isset($this->debug_flag) && $this->debug_flag) {
4277  $payload .= "<!-- Content will not be deflated: no gzcompress -->";
4278  }
4279  }
4280  }
4281  }
4282  //end code
4283  $this->outgoing_headers[] = "Content-Length: " . strlen($payload);
4284  reset($this->outgoing_headers);
4285  foreach ($this->outgoing_headers as $hdr) {
4286  header($hdr, false);
4287  }
4288  print $payload;
4289  $this->response = join("\r\n", $this->outgoing_headers) . "\r\n\r\n" . $payload;
4290  }
& getDebugAsXMLComment()
gets the current debug data for this instance as an XML comment this may change the contents of the d...
Definition: nusoap.php:346
getHTTPBody($soapmsg)
gets the HTTP body for the current response.
Definition: nusoap.php:4373
if(count($parts) !=3) $payload
Definition: ltitoken.php:70
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4503
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
getHTTPContentType()
gets the HTTP content type for the current response.
Definition: nusoap.php:4386
getHTTPContentTypeCharset()
gets the HTTP content type charset for the current response.
Definition: nusoap.php:4400
+ Here is the call graph for this function:

◆ serialize_return()

nusoap_server::serialize_return ( )

serializes the return value from a PHP function into a full SOAP Envelope

The following fields are set by this function (when successful)

responseSOAP

This sets the fault field on error

private

Definition at line 4128 of file nusoap.php.

References $payload, nusoap_base\appendDebug(), nusoap_base\clearDebug(), nusoap_base\debug(), nusoap_base\getDebug(), nusoap_base\getError(), nusoap_base\serialize_val(), nusoap_base\serializeEnvelope(), wsdl\serializeRPCParameters(), and nusoap_base\varDump().

4129  {
4130  $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);
4131  // if fault
4132  if (isset($this->methodreturn) && ((get_class((object)$this->methodreturn) == 'soap_fault') || (get_class((object)$this->methodreturn) == 'nusoap_fault'))) {
4133  $this->debug('got a fault object from method');
4134  $this->fault = $this->methodreturn;
4135  return;
4136  } elseif ($this->methodreturnisliteralxml) {
4137  $return_val = $this->methodreturn;
4138  // returned value(s)
4139  } else {
4140  $this->debug('got a(n) ' . gettype($this->methodreturn) . ' from method');
4141  $this->debug('serializing return value');
4142  if ($this->wsdl) {
4143  if (sizeof($this->opData['output']['parts']) > 1) {
4144  $this->debug('more than one output part, so use the method return unchanged');
4145  $opParams = $this->methodreturn;
4146  } elseif (sizeof($this->opData['output']['parts']) == 1) {
4147  $this->debug('exactly one output part, so wrap the method return in a simple array');
4148  // TODO: verify that it is not already wrapped!
4149  //foreach ($this->opData['output']['parts'] as $name => $type) {
4150  // $this->debug('wrap in element named ' . $name);
4151  //}
4152  $opParams = array($this->methodreturn);
4153  }
4154  $return_val = $this->wsdl->serializeRPCParameters($this->methodname, 'output', $opParams);
4155  $this->appendDebug($this->wsdl->getDebug());
4156  $this->wsdl->clearDebug();
4157  if ($errstr = $this->wsdl->getError()) {
4158  $this->debug('got wsdl error: ' . $errstr);
4159  $this->fault('SOAP-ENV:Server', 'unable to serialize result');
4160  return;
4161  }
4162  } else {
4163  if (isset($this->methodreturn)) {
4164  $return_val = $this->serialize_val($this->methodreturn, 'return');
4165  } else {
4166  $return_val = '';
4167  $this->debug('in absence of WSDL, assume void return for backward compatibility');
4168  }
4169  }
4170  }
4171  $this->debug('return value:');
4172  $this->appendDebug($this->varDump($return_val));
4173 
4174  $this->debug('serializing response');
4175  if ($this->wsdl) {
4176  $this->debug('have WSDL for serialization: style is ' . $this->opData['style']);
4177  if ($this->opData['style'] == 'rpc') {
4178  $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']);
4179  if ($this->opData['output']['use'] == 'literal') {
4180  // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace
4181  $payload = '<ns1:' . $this->methodname . 'Response xmlns:ns1="' . $this->methodURI . '">' . $return_val . '</ns1:' . $this->methodname . "Response>";
4182  } else {
4183  $payload = '<ns1:' . $this->methodname . 'Response xmlns:ns1="' . $this->methodURI . '">' . $return_val . '</ns1:' . $this->methodname . "Response>";
4184  }
4185  } else {
4186  $this->debug('style is not rpc for serialization: assume document');
4187  $payload = $return_val;
4188  }
4189  } else {
4190  $this->debug('do not have WSDL for serialization: assume rpc/encoded');
4191  $payload = '<ns1:' . $this->methodname . 'Response xmlns:ns1="' . $this->methodURI . '">' . $return_val . '</ns1:' . $this->methodname . "Response>";
4192  }
4193  $this->result = 'successful';
4194  if ($this->wsdl) {
4195  //if($this->debug_flag){
4196  $this->appendDebug($this->wsdl->getDebug());
4197  // }
4198  if (isset($opData['output']['encodingStyle'])) {
4199  $encodingStyle = $opData['output']['encodingStyle'];
4200  } else {
4201  $encodingStyle = '';
4202  }
4203  // Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces.
4204  $this->responseSOAP = $this->serializeEnvelope($payload, $this->responseHeaders, $this->wsdl->usedNamespaces, $this->opData['style'], $this->opData['output']['use'], $encodingStyle);
4205  } else {
4206  $this->responseSOAP = $this->serializeEnvelope($payload, $this->responseHeaders);
4207  }
4208  $this->debug("Leaving serialize_return");
4209  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:305
& getDebug()
gets the current debug data for this instance
Definition: nusoap.php:332
parses a WSDL file, allows access to it&#39;s data, other utility methods.
Definition: nusoap.php:4615
if(count($parts) !=3) $payload
Definition: ltitoken.php:70
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4503
getError()
returns error string if present
Definition: nusoap.php:381
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
serializeRPCParameters($operation, $direction, $parameters, $bindingType='soap')
serialize PHP values according to a WSDL message definition contrary to the method name...
Definition: nusoap.php:5732
serializeEnvelope($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded', $encodingStyle='http://schemas.xmlsoap.org/soap/encoding/')
serializes a message
Definition: nusoap.php:700
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:909
clearDebug()
clears the current debug data for this instance
Definition: nusoap.php:319
serialize_val($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded', $soapval=false)
serializes PHP values in accordance w/ section 5.
Definition: nusoap.php:433
+ Here is the call graph for this function:

◆ service()

nusoap_server::service (   $data)

processes request and returns response

Parameters
string$datausually is the value of $HTTP_RAW_POST_DATA public

Definition at line 3742 of file nusoap.php.

References $_SERVER, $data, nusoap_base\appendDebug(), nusoap_base\debug(), nusoap_base\getDebugAsXMLComment(), ILIAS\UI\examples\Symbol\Glyph\Header\header(), wsdl\serialize(), nusoap_base\varDump(), and wsdl\webDescription().

3743  {
3744  global $HTTP_SERVER_VARS;
3745 
3746  if (isset($_SERVER['QUERY_STRING'])) {
3747  $qs = $_SERVER['QUERY_STRING'];
3748  } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
3749  $qs = $HTTP_SERVER_VARS['QUERY_STRING'];
3750  } else {
3751  $qs = '';
3752  }
3753  $this->debug("In service, query string=$qs");
3754 
3755  if (preg_match('/wsdl/', $qs)) {
3756  $this->debug("In service, this is a request for WSDL");
3757  if ($this->externalWSDLURL) {
3758  if (strpos($this->externalWSDLURL, "://")!==false) { // assume URL
3759  header('Location: ' . $this->externalWSDLURL);
3760  } else { // assume file
3761  header("Content-Type: text/xml\r\n");
3762  $fp = fopen($this->externalWSDLURL, 'r');
3763  fpassthru($fp);
3764  }
3765  } elseif ($this->wsdl) {
3766  header("Content-Type: text/xml; charset=ISO-8859-1\r\n");
3767  print $this->wsdl->serialize($this->debug_flag);
3768  if ($this->debug_flag) {
3769  $this->debug('wsdl:');
3770  $this->appendDebug($this->varDump($this->wsdl));
3771  print $this->getDebugAsXMLComment();
3772  }
3773  } else {
3774  header("Content-Type: text/html; charset=ISO-8859-1\r\n");
3775  print "This service does not provide WSDL";
3776  }
3777  } elseif ($data == '' && $this->wsdl) {
3778  $this->debug("In service, there is no data, so return Web description");
3779  print $this->wsdl->webDescription();
3780  } else {
3781  $this->debug("In service, invoke the request");
3782  $this->parse_request($data);
3783  if (! $this->fault) {
3784  $this->invoke_method();
3785  }
3786  if (! $this->fault) {
3787  $this->serialize_return();
3788  }
3789  $this->send_response();
3790  }
3791  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:305
& getDebugAsXMLComment()
gets the current debug data for this instance as an XML comment this may change the contents of the d...
Definition: nusoap.php:346
parses a WSDL file, allows access to it&#39;s data, other utility methods.
Definition: nusoap.php:4615
send_response()
sends an HTTP response
Definition: nusoap.php:4221
parse_request($data='')
parses a request
Definition: nusoap.php:3934
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4503
serialize_return()
serializes the return value from a PHP function into a full SOAP Envelope
Definition: nusoap.php:4128
serialize($debug=0)
serialize the parsed wsdl
Definition: nusoap.php:5494
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
invoke_method()
invokes a PHP function for the requested SOAP method
Definition: nusoap.php:3982
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
webDescription()
prints html description of services
Definition: nusoap.php:5352
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:909
+ Here is the call graph for this function:

◆ verify_method()

nusoap_server::verify_method (   $operation,
  $request 
)

takes the value that was created by parsing the request and compares to the method's signature, if available.

Parameters
string$operationThe operation to be invoked
array$requestThe array of parameter values
Returns
boolean Whether the operation was found private

Definition at line 4301 of file nusoap.php.

References wsdl\getOperationData().

4302  {
4303  if (isset($this->wsdl) && is_object($this->wsdl)) {
4304  if ($this->wsdl->getOperationData($operation)) {
4305  return true;
4306  }
4307  } elseif (isset($this->operations[$operation])) {
4308  return true;
4309  }
4310  return false;
4311  }
parses a WSDL file, allows access to it&#39;s data, other utility methods.
Definition: nusoap.php:4615
getOperationData($operation, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:5224
+ Here is the call graph for this function:

Field Documentation

◆ $debug_flag

nusoap_server::$debug_flag = false

Definition at line 3668 of file nusoap.php.

◆ $decode_utf8

nusoap_server::$decode_utf8 = true

Definition at line 3593 of file nusoap.php.

◆ $document

nusoap_server::$document = ''

Definition at line 3551 of file nusoap.php.

◆ $externalWSDLURL

nusoap_server::$externalWSDLURL = false

Definition at line 3662 of file nusoap.php.

◆ $fault

nusoap_server::$fault = false

Definition at line 3636 of file nusoap.php.

◆ $headers

nusoap_server::$headers = array()

Definition at line 3527 of file nusoap.php.

◆ $methodname

nusoap_server::$methodname = ''

Definition at line 3569 of file nusoap.php.

◆ $methodparams

nusoap_server::$methodparams = array()

Definition at line 3575 of file nusoap.php.

◆ $methodreturn

nusoap_server::$methodreturn = false

Definition at line 3624 of file nusoap.php.

◆ $methodreturnisliteralxml

nusoap_server::$methodreturnisliteralxml = false

Definition at line 3630 of file nusoap.php.

◆ $methodURI

nusoap_server::$methodURI = ''

Definition at line 3563 of file nusoap.php.

◆ $operations

nusoap_server::$operations = array()

Definition at line 3650 of file nusoap.php.

◆ $outgoing_headers

nusoap_server::$outgoing_headers = array()

Definition at line 3600 of file nusoap.php.

◆ $request

nusoap_server::$request = ''

Definition at line 3533 of file nusoap.php.

◆ $requestHeader

nusoap_server::$requestHeader = null

Definition at line 3545 of file nusoap.php.

◆ $requestHeaders

nusoap_server::$requestHeaders = ''

Definition at line 3539 of file nusoap.php.

◆ $requestSOAP

nusoap_server::$requestSOAP = ''

Definition at line 3557 of file nusoap.php.

◆ $response

nusoap_server::$response = ''

Definition at line 3606 of file nusoap.php.

◆ $responseHeaders

nusoap_server::$responseHeaders = ''

Definition at line 3612 of file nusoap.php.

◆ $responseSOAP

nusoap_server::$responseSOAP = ''

Definition at line 3618 of file nusoap.php.

◆ $result

nusoap_server::$result = 'successful'

Definition at line 3642 of file nusoap.php.

◆ $SOAPAction

nusoap_server::$SOAPAction = ''

Definition at line 3581 of file nusoap.php.

◆ $wsdl

nusoap_server::$wsdl = false

Definition at line 3656 of file nusoap.php.

◆ $xml_encoding

nusoap_server::$xml_encoding = ''

Definition at line 3587 of file nusoap.php.


The documentation for this class was generated from the following file: