ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
 debug ($string)
 adds debug data to the class level debug string 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')
 serializes PHP values in accordance w/ section 5. More...
 
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded')
 serialize message More...
 
 formatDump ($str)
 
 contractQname ($qname)
 contracts a qualified name More...
 
 expandQname ($qname)
 expands 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 returns false if no namespace registered with the given prefix More...
 
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace More...
 
 varDump ($data)
 
 __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.6.7'
 
 $revision = '$Revision$'
 
 $error_str = false
 
 $debug_str = ''
 
 $charencoding = true
 
 $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 
 $soap_defencoding = 'UTF-8'
 
 $namespaces
 
 $usedNamespaces = array()
 
 $typemap
 
 $xmlEntities
 
 $debugLevel
 

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 3434 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 3591 of file nusoap.php.

References $_SERVER, $debug, nusoap_base\appendDebug(), nusoap_base\clearDebug(), nusoap_base\debug(), nusoap_base\getDebug(), nusoap_base\getError(), nusoap_base\varDump(), and wsdl\wsdl().

3591  {
3592  parent::__construct();
3593  // turn on debugging?
3594  global $debug;
3595  global $HTTP_SERVER_VARS;
3596 
3597  if (isset($_SERVER)) {
3598  $this->debug("_SERVER is defined:");
3599  $this->appendDebug($this->varDump($_SERVER));
3600  } elseif (isset($HTTP_SERVER_VARS)) {
3601  $this->debug("HTTP_SERVER_VARS is defined:");
3602  $this->appendDebug($this->varDump($HTTP_SERVER_VARS));
3603  } else {
3604  $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
3605  }
3606 
3607  if (isset($debug)) {
3608  $this->debug("In nusoap_server, set debug_flag=$debug based on global flag");
3609  $this->debug_flag = $debug;
3610  } elseif (isset($_SERVER['QUERY_STRING'])) {
3611  $qs = explode('&', $_SERVER['QUERY_STRING']);
3612  foreach ($qs as $v) {
3613  if (substr($v, 0, 6) == 'debug=') {
3614  $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1");
3615  $this->debug_flag = substr($v, 6);
3616  }
3617  }
3618  } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
3619  $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']);
3620  foreach ($qs as $v) {
3621  if (substr($v, 0, 6) == 'debug=') {
3622  $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
3623  $this->debug_flag = substr($v, 6);
3624  }
3625  }
3626  }
3627 
3628  // wsdl
3629  if($wsdl){
3630  $this->debug("In nusoap_server, WSDL is specified");
3631  if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) {
3632  $this->wsdl = $wsdl;
3633  $this->externalWSDLURL = $this->wsdl->wsdl;
3634  $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
3635  } else {
3636  $this->debug('Create wsdl from ' . $wsdl);
3637  $this->wsdl = new wsdl($wsdl);
3638  $this->externalWSDLURL = $wsdl;
3639  }
3640  $this->appendDebug($this->wsdl->getDebug());
3641  $this->wsdl->clearDebug();
3642  if($err = $this->wsdl->getError()){
3643  die('WSDL ERROR: '.$err);
3644  }
3645  }
3646  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:294
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
& getDebug()
gets the current debug data for this instance
Definition: nusoap.php:319
parses a WSDL file, allows access to it's data, other utility methods
Definition: nusoap.php:3133
getError()
returns error string if present
Definition: nusoap.php:171
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
wsdl($wsdl='', $proxyhost=false, $proxyport=false, $proxyusername=false, $proxypassword=false, $timeout=0, $response_timeout=30)
constructor
Definition: nusoap.php:3181
varDump($data)
Definition: nusoap.php:567
$debug
Definition: loganalyzer.php:16
clearDebug()
clears the current debug data for this instance
Definition: nusoap.php:307
+ 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 4314 of file nusoap.php.

References $in, $out, and array.

4314  {
4315  $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out);
4316  }
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37

◆ 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 4420 of file nusoap.php.

References $_SERVER, $bindings, $endpoint, $messages, $namespace, $parser, $style, array, and nusoap_base\setError().

4420  ://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false)
4421  {
4422  global $HTTP_SERVER_VARS;
4423 
4424  if (isset($_SERVER)) {
4425  $SERVER_NAME = $_SERVER['SERVER_NAME'];
4426  $SERVER_PORT = $_SERVER['SERVER_PORT'];
4427  $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
4428  $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
4429  } elseif (isset($HTTP_SERVER_VARS)) {
4430  $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
4431  $SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT'];
4432  $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
4433  $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
4434  } else {
4435  $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
4436  }
4437  // If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI)
4438  $colon = strpos($SERVER_NAME,":");
4439  if ($colon) {
4440  $SERVER_NAME = substr($SERVER_NAME, 0, $colon);
4441  }
4442  if ($SERVER_PORT == 80) {
4443  $SERVER_PORT = '';
4444  } else {
4445  $SERVER_PORT = ':' . $SERVER_PORT;
4446  }
4447  if(false == $namespace) {
4448  $namespace = "http://$SERVER_NAME/soap/$serviceName";
4449  }
4450 
4451  if(false == $endpoint) {
4452  if ($HTTPS == '1' || $HTTPS == 'on') {
4453  $SCHEME = 'https';
4454  } else {
4455  $SCHEME = 'http';
4456  }
4457  $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME";
4458  }
4459 
4460  if(false == $schemaTargetNamespace) {
4461  $schemaTargetNamespace = $namespace;
4462  }
4463 
4464  $this->wsdl = new wsdl;
4465  $this->wsdl->serviceName = $serviceName;
4466  $this->wsdl->endpoint = $endpoint;
4467  $this->wsdl->namespaces['tns'] = $namespace;
4468  $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/';
4469  $this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/';
4470  if ($schemaTargetNamespace != $namespace) {
4471  $this->wsdl->namespaces['types'] = $schemaTargetNamespace;
4472  }
4473  $this->wsdl->schemas[$schemaTargetNamespace][0] = new nusoap_xmlschema('', '', $this->wsdl->namespaces);
4474  if ($style == 'document') {
4475  $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified';
4476  }
4477  $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace;
4478  $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array('location' => '', 'loaded' => true);
4479  $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array('location' => '', 'loaded' => true);
4480  $this->wsdl->bindings[$serviceName.'Binding'] = array(
4481  'name'=>$serviceName.'Binding',
4482  'style'=>$style,
4483  'transport'=>$transport,
4484  'portType'=>$serviceName.'PortType');
4485  $this->wsdl->ports[$serviceName.'Port'] = array(
4486  'binding'=>$serviceName.'Binding',
4487  'location'=>$endpoint,
4488  'bindingType'=>'http://schemas.xmlsoap.org/wsdl/soap/');
4489  }
if($err=$client->getError()) $namespace
setError($str)
sets error string
Definition: nusoap.php:184
$style
Definition: example_012.php:70
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
parses a WSDL file, allows access to it's data, other utility methods
Definition: nusoap.php:3133
$endpoint
parses an XML Schema, allows access to it's data, other utility methods.
Definition: nusoap.php:1092
Create styles array
The data for the language used.
+ 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 4401 of file nusoap.php.

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

4401  {
4402  if ($faultdetail == '' && $this->debug_flag) {
4403  $faultdetail = $this->getDebug();
4404  }
4405  $this->fault = new nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail);
4406  $this->fault->soap_defencoding = $this->soap_defencoding;
4407  }
Contains information for a SOAP fault.
Definition: nusoap.php:1004
& getDebug()
gets the current debug data for this instance
Definition: nusoap.php:319
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4401
$soap_defencoding
Definition: nusoap.php:86
+ 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 4276 of file nusoap.php.

4276  {
4277  return $soapmsg;
4278  }

◆ 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 4288 of file nusoap.php.

4288  {
4289  return 'text/xml';
4290  }

◆ 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 4301 of file nusoap.php.

References nusoap_base\$soap_defencoding.

4301  {
4302  return $this->soap_defencoding;
4303  }
$soap_defencoding
Definition: nusoap.php:86

◆ 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 3889 of file nusoap.php.

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

3889  {
3890  $this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction);
3891 
3892  if ($this->wsdl) {
3893  if ($this->opData = $this->wsdl->getOperationData($this->methodname)) {
3894  $this->debug('in invoke_method, found WSDL operation=' . $this->methodname);
3895  $this->appendDebug('opData=' . $this->varDump($this->opData));
3896  } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) {
3897  // Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element
3898  $this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']);
3899  $this->appendDebug('opData=' . $this->varDump($this->opData));
3900  $this->methodname = $this->opData['name'];
3901  } else {
3902  $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname);
3903  $this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service");
3904  return;
3905  }
3906  } else {
3907  $this->debug('in invoke_method, no WSDL to validate method');
3908  }
3909 
3910  // if a . is present in $this->methodname, we see if there is a class in scope,
3911  // which could be referred to. We will also distinguish between two deliminators,
3912  // to allow methods to be called a the class or an instance
3913  $class = '';
3914  $method = '';
3915  if (strpos($this->methodname, '..') > 0) {
3916  $delim = '..';
3917  } else if (strpos($this->methodname, '.') > 0) {
3918  $delim = '.';
3919  } else {
3920  $delim = '';
3921  }
3922 
3923  if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1 &&
3924  class_exists(substr($this->methodname, 0, strpos($this->methodname, $delim)))) {
3925  // get the class and method name
3926  $class = substr($this->methodname, 0, strpos($this->methodname, $delim));
3927  $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
3928  $this->debug("in invoke_method, class=$class method=$method delim=$delim");
3929  }
3930  // set class handler
3931  // added to support single operations
3932  if ($class == '' && $this->class !='')
3933  {
3934  $class = $this->class;
3935  $delim = "..";
3936  $method = $this->methodname;
3937  }
3938 
3939  // does method exist?
3940  if ($class == '') {
3941  if (!function_exists($this->methodname)) {
3942  $this->debug("in invoke_method, function '$this->methodname' not found!");
3943  $this->result = 'fault: method not found';
3944  $this->fault('SOAP-ENV:Client',"method '$this->methodname' not defined in service");
3945  return;
3946  }
3947  } else {
3948  $method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method;
3949  if (!in_array($method_to_compare, get_class_methods($class))) {
3950  $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!");
3951  $this->result = 'fault: method not found';
3952  $this->fault('SOAP-ENV:Client',"method '$this->methodname' not defined in service");
3953  return;
3954  }
3955  }
3956 
3957  // evaluate message, getting back parameters
3958  // verify that request parameters match the method's signature
3959  if(! $this->verify_method($this->methodname,$this->methodparams)){
3960  // debug
3961  $this->debug('ERROR: request not verified against method signature');
3962  $this->result = 'fault: request failed validation against method signature';
3963  // return fault
3964  $this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service.");
3965  return;
3966  }
3967 
3968  // if there are parameters to pass
3969  $this->debug('in invoke_method, params:');
3970  $this->appendDebug($this->varDump($this->methodparams));
3971  $this->debug("in invoke_method, calling '$this->methodname'");
3972  if (!function_exists('call_user_func_array')) {
3973  if ($class == '') {
3974  $this->debug('in invoke_method, calling function using eval()');
3975  $funcCall = "\$this->methodreturn = $this->methodname(";
3976  } else {
3977  if ($delim == '..') {
3978  $this->debug('in invoke_method, calling class method using eval()');
3979  $funcCall = "\$this->methodreturn = ".$class."::".$method."(";
3980  } else {
3981  $this->debug('in invoke_method, calling instance method using eval()');
3982  // generate unique instance name
3983  $instname = "\$inst_".time();
3984  $funcCall = $instname." = new ".$class."(); ";
3985  $funcCall .= "\$this->methodreturn = ".$instname."->".$method."(";
3986  }
3987  }
3988  if ($this->methodparams) {
3989  foreach ($this->methodparams as $param) {
3990  if (is_array($param) || is_object($param)) {
3991  $this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available');
3992  return;
3993  }
3994  $funcCall .= "\"$param\",";
3995  }
3996  $funcCall = substr($funcCall, 0, -1);
3997  }
3998  $funcCall .= ');';
3999  $this->debug('in invoke_method, function call: '.$funcCall);
4000  @eval($funcCall);
4001  } else {
4002  if ($class == '') {
4003  $this->debug('in invoke_method, calling function using call_user_func_array()');
4004  $call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case after call_user_func_array()
4005  } elseif ($delim == '..') {
4006  $this->debug('in invoke_method, calling class method using call_user_func_array()');
4007  $call_arg = array ($class, $method);
4008  } else {
4009  $this->debug('in invoke_method, calling instance method using call_user_func_array()');
4010  $instance = new $class ();
4011  $call_arg = array(&$instance, $method);
4012  }
4013  if (is_array($this->methodparams)) {
4014  $this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams));
4015  } else {
4016  $this->methodreturn = call_user_func_array($call_arg, array());
4017  }
4018  }
4019  $this->debug('in invoke_method, methodreturn:');
4020  $this->appendDebug($this->varDump($this->methodreturn));
4021  $this->debug("in invoke_method, called method $this->methodname, received data of type ".gettype($this->methodreturn));
4022  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:294
parses a WSDL file, allows access to it's data, other utility methods
Definition: nusoap.php:3133
getOperationDataForSoapAction($soapAction, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:5144
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4401
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
verify_method($operation, $request)
takes the value that was created by parsing the request and compares to the method's signature...
Definition: nusoap.php:4206
Create styles array
The data for the language used.
varDump($data)
Definition: nusoap.php:567
getOperationData($operation, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:3679
+ 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 3716 of file nusoap.php.

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

3716  {
3717  global $HTTP_SERVER_VARS;
3718 
3719  $this->request = '';
3720  $this->SOAPAction = '';
3721  if(function_exists('getallheaders')){
3722  $this->debug("In parse_http_headers, use getallheaders");
3723  $headers = getallheaders();
3724  foreach($headers as $k=>$v){
3725  $k = strtolower($k);
3726  $this->headers[$k] = $v;
3727  $this->request .= "$k: $v\r\n";
3728  $this->debug("$k: $v");
3729  }
3730  // get SOAPAction header
3731  if(isset($this->headers['soapaction'])){
3732  $this->SOAPAction = str_replace('"','',$this->headers['soapaction']);
3733  }
3734  // get the character encoding of the incoming request
3735  if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
3736  $enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
3737  if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
3738  $this->xml_encoding = strtoupper($enc);
3739  } else {
3740  $this->xml_encoding = 'US-ASCII';
3741  }
3742  } else {
3743  // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
3744  $this->xml_encoding = 'ISO-8859-1';
3745  }
3746  } elseif(isset($_SERVER) && is_array($_SERVER)){
3747  $this->debug("In parse_http_headers, use _SERVER");
3748  foreach ($_SERVER as $k => $v) {
3749  if (substr($k, 0, 5) == 'HTTP_') {
3750  $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5))));
3751  } else {
3752  $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k)));
3753  }
3754  if ($k == 'soapaction') {
3755  // get SOAPAction header
3756  $k = 'SOAPAction';
3757  $v = str_replace('"', '', $v);
3758  $v = str_replace('\\', '', $v);
3759  $this->SOAPAction = $v;
3760  } else if ($k == 'content-type') {
3761  // get the character encoding of the incoming request
3762  if (strpos($v, '=')) {
3763  $enc = substr(strstr($v, '='), 1);
3764  $enc = str_replace('"', '', $enc);
3765  $enc = str_replace('\\', '', $enc);
3766  if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) {
3767  $this->xml_encoding = strtoupper($enc);
3768  } else {
3769  $this->xml_encoding = 'US-ASCII';
3770  }
3771  } else {
3772  // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
3773  $this->xml_encoding = 'ISO-8859-1';
3774  }
3775  }
3776  $this->headers[$k] = $v;
3777  $this->request .= "$k: $v\r\n";
3778  $this->debug("$k: $v");
3779  }
3780  } elseif (is_array($HTTP_SERVER_VARS)) {
3781  $this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
3782  foreach ($HTTP_SERVER_VARS as $k => $v) {
3783  if (substr($k, 0, 5) == 'HTTP_') {
3784  $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); $k = strtolower(substr($k, 5));
3785  } else {
3786  $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); $k = strtolower($k);
3787  }
3788  if ($k == 'soapaction') {
3789  // get SOAPAction header
3790  $k = 'SOAPAction';
3791  $v = str_replace('"', '', $v);
3792  $v = str_replace('\\', '', $v);
3793  $this->SOAPAction = $v;
3794  } else if ($k == 'content-type') {
3795  // get the character encoding of the incoming request
3796  if (strpos($v, '=')) {
3797  $enc = substr(strstr($v, '='), 1);
3798  $enc = str_replace('"', '', $enc);
3799  $enc = str_replace('\\', '', $enc);
3800  if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) {
3801  $this->xml_encoding = strtoupper($enc);
3802  } else {
3803  $this->xml_encoding = 'US-ASCII';
3804  }
3805  } else {
3806  // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
3807  $this->xml_encoding = 'ISO-8859-1';
3808  }
3809  }
3810  $this->headers[$k] = $v;
3811  $this->request .= "$k: $v\r\n";
3812  $this->debug("$k: $v");
3813  }
3814  } else {
3815  $this->debug("In parse_http_headers, HTTP headers not accessible");
3816  $this->setError("HTTP headers not accessible");
3817  }
3818  }
setError($str)
sets error string
Definition: nusoap.php:184
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
+ 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 3842 of file nusoap.php.

References $data, and nusoap_base\debug().

3842  {
3843  $this->debug('entering parse_request()');
3844  $this->parse_http_headers();
3845  $this->debug('got character encoding: '.$this->xml_encoding);
3846  // uncompress if necessary
3847  if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') {
3848  $this->debug('got content encoding: ' . $this->headers['content-encoding']);
3849  if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') {
3850  // if decoding works, use it. else assume data wasn't gzencoded
3851  if (function_exists('gzuncompress')) {
3852  if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
3853  $data = $degzdata;
3854  } elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) {
3855  $data = $degzdata;
3856  } else {
3857  $this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data');
3858  return;
3859  }
3860  } else {
3861  $this->fault('SOAP-ENV:Client', 'This Server does not support compressed data');
3862  return;
3863  }
3864  }
3865  }
3866  $this->request .= "\r\n".$data;
3867  $data = $this->parseRequest($this->headers, $data);
3868  $this->requestSOAP = $data;
3869  $this->debug('leaving parse_request');
3870  }
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4401
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
parseRequest($headers, $data)
processes SOAP message received from client
Definition: nusoap.php:4225
parse_http_headers()
parses HTTP request headers.
Definition: nusoap.php:3716
+ 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 4225 of file nusoap.php.

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

4225  {
4226  $this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' and type ' . $headers['content-type']);
4227  if (!strstr($headers['content-type'], 'text/xml')) {
4228  $this->setError('Request not of type text/xml');
4229  return false;
4230  }
4231  if (strpos($headers['content-type'], '=')) {
4232  $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
4233  $this->debug('Got response encoding: ' . $enc);
4234  if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
4235  $this->xml_encoding = strtoupper($enc);
4236  } else {
4237  $this->xml_encoding = 'US-ASCII';
4238  }
4239  } else {
4240  // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
4241  $this->xml_encoding = 'ISO-8859-1';
4242  }
4243  $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
4244  // parse response, get soap parser obj
4245  $parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8);
4246  // parser debug
4247  $this->debug("parser debug: \n".$parser->getDebug());
4248  // if fault occurred during message parsing
4249  if($err = $parser->getError()){
4250  $this->result = 'fault: error in msg parsing: '.$err;
4251  $this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err);
4252  // else successfully parsed request into soapval object
4253  } else {
4254  // get/set methodname
4255  $this->methodURI = $parser->root_struct_namespace;
4256  $this->methodname = $parser->root_struct_name;
4257  $this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI);
4258  $this->debug('calling parser->get_soapbody()');
4259  $this->methodparams = $parser->get_soapbody();
4260  // get SOAP headers
4261  $this->requestHeaders = $parser->getHeaders();
4262  // get SOAP Header
4263  $this->requestHeader = $parser->get_soapheader();
4264  // add document for doclit support
4265  $this->document = $parser->document;
4266  }
4267  }
setError($str)
sets error string
Definition: nusoap.php:184
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4401
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
$parser
Definition: BPMN2Parser.php:23
nusoap_parser class parses SOAP XML messages into native PHP values
Definition: nusoap.php:6417
+ 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 4332 of file nusoap.php.

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

4332  {
4333  global $HTTP_SERVER_VARS;
4334 
4335  if($this->externalWSDLURL){
4336  die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.');
4337  }
4338  if (! $name) {
4339  die('You must specify a name when you register an operation');
4340  }
4341  if (!is_array($in)) {
4342  die('You must provide an array for operation inputs');
4343  }
4344  if (!is_array($out)) {
4345  die('You must provide an array for operation outputs');
4346  }
4347  if(false == $namespace) {
4348  }
4349  if(false == $soapaction) {
4350  if (isset($_SERVER)) {
4351  $SERVER_NAME = $_SERVER['SERVER_NAME'];
4352  $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
4353  $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
4354  } elseif (isset($HTTP_SERVER_VARS)) {
4355  $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
4356  $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
4357  $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
4358  } else {
4359  $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
4360  }
4361  if ($HTTPS == '1' || $HTTPS == 'on') {
4362  $SCHEME = 'https';
4363  } else {
4364  $SCHEME = 'http';
4365  }
4366  $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name";
4367  }
4368  if(false == $style) {
4369  $style = "rpc";
4370  }
4371  if(false == $use) {
4372  $use = "encoded";
4373  }
4374  if ($use == 'encoded' && $encodingStyle = '') {
4375  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
4376  }
4377 
4378  $this->operations[$name] = array(
4379  'name' => $name,
4380  'in' => $in,
4381  'out' => $out,
4382  'namespace' => $namespace,
4383  'soapaction' => $soapaction,
4384  'style' => $style);
4385  if($this->wsdl){
4386  $this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle);
4387  }
4388  return true;
4389  }
if($err=$client->getError()) $namespace
setError($str)
sets error string
Definition: nusoap.php:184
$style
Definition: example_012.php:70
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
parses a WSDL file, allows access to it's data, other utility methods
Definition: nusoap.php:3133
addOperation($name, $in=false, $out=false, $namespace=false, $soapaction=false, $style='rpc', $use='encoded', $documentation='')
register a service with the server
Definition: nusoap.php:4362
if($format !==null) $name
Definition: metadata.php:146
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
+ 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 4127 of file nusoap.php.

References $type, nusoap_base\debug(), nusoap_base\getDebugAsXMLComment(), and header.

4127  {
4128  $this->debug('Enter send_response');
4129  if ($this->fault) {
4130  $payload = $this->fault->serialize();
4131  $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error";
4132  $this->outgoing_headers[] = "Status: 500 Internal Server Error";
4133  } else {
4134  $payload = $this->responseSOAP;
4135  // Some combinations of PHP+Web server allow the Status
4136  // to come through as a header. Since OK is the default
4137  // just do nothing.
4138  // $this->outgoing_headers[] = "HTTP/1.0 200 OK";
4139  // $this->outgoing_headers[] = "Status: 200 OK";
4140  }
4141  // add debug data if in debug mode
4142  if(isset($this->debug_flag) && $this->debug_flag){
4143  $payload .= $this->getDebugAsXMLComment();
4144  }
4145  $this->outgoing_headers[] = "Server: $this->title Server v$this->version";
4146  preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
4147  $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
4148  // Let the Web server decide about this
4149  //$this->outgoing_headers[] = "Connection: Close\r\n";
4150  $payload = $this->getHTTPBody($payload);
4151  $type = $this->getHTTPContentType();
4152  $charset = $this->getHTTPContentTypeCharset();
4153  $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : '');
4154  //begin code to compress payload - by John
4155  // NOTE: there is no way to know whether the Web server will also compress
4156  // this data.
4157  if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {
4158  if (strstr($this->headers['accept-encoding'], 'gzip')) {
4159  if (function_exists('gzencode')) {
4160  if (isset($this->debug_flag) && $this->debug_flag) {
4161  $payload .= "<!-- Content being gzipped -->";
4162  }
4163  $this->outgoing_headers[] = "Content-Encoding: gzip";
4164  $payload = gzencode($payload);
4165  } else {
4166  if (isset($this->debug_flag) && $this->debug_flag) {
4167  $payload .= "<!-- Content will not be gzipped: no gzencode -->";
4168  }
4169  }
4170  } elseif (strstr($this->headers['accept-encoding'], 'deflate')) {
4171  // Note: MSIE requires gzdeflate output (no Zlib header and checksum),
4172  // instead of gzcompress output,
4173  // which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5)
4174  if (function_exists('gzdeflate')) {
4175  if (isset($this->debug_flag) && $this->debug_flag) {
4176  $payload .= "<!-- Content being deflated -->";
4177  }
4178  $this->outgoing_headers[] = "Content-Encoding: deflate";
4179  $payload = gzdeflate($payload);
4180  } else {
4181  if (isset($this->debug_flag) && $this->debug_flag) {
4182  $payload .= "<!-- Content will not be deflated: no gzcompress -->";
4183  }
4184  }
4185  }
4186  }
4187  //end code
4188  $this->outgoing_headers[] = "Content-Length: ".strlen($payload);
4189  reset($this->outgoing_headers);
4190  foreach($this->outgoing_headers as $hdr){
4191  header($hdr, false);
4192  }
4193  print $payload;
4194  $this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload;
4195  }
& getDebugAsXMLComment()
gets the current debug data for this instance as an XML comment this may change the contents of the d...
Definition: nusoap.php:332
getHTTPBody($soapmsg)
gets the HTTP body for the current response.
Definition: nusoap.php:4276
$type
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4401
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
getHTTPContentType()
gets the HTTP content type for the current response.
Definition: nusoap.php:4288
Add a drawing to the header
Definition: 04printing.php:69
getHTTPContentTypeCharset()
gets the HTTP content type charset for the current response.
Definition: nusoap.php:4301
+ 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 4035 of file nusoap.php.

References nusoap_base\appendDebug(), array, 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().

4035  {
4036  $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);
4037  // if fault
4038  if (isset($this->methodreturn) && ((get_class((object)$this->methodreturn) == 'soap_fault') || (get_class((object)$this->methodreturn) == 'nusoap_fault'))) {
4039  $this->debug('got a fault object from method');
4040  $this->fault = $this->methodreturn;
4041  return;
4042  } elseif ($this->methodreturnisliteralxml) {
4043  $return_val = $this->methodreturn;
4044  // returned value(s)
4045  } else {
4046  $this->debug('got a(n) '.gettype($this->methodreturn).' from method');
4047  $this->debug('serializing return value');
4048  if($this->wsdl){
4049  if (sizeof($this->opData['output']['parts']) > 1) {
4050  $this->debug('more than one output part, so use the method return unchanged');
4051  $opParams = $this->methodreturn;
4052  } elseif (sizeof($this->opData['output']['parts']) == 1) {
4053  $this->debug('exactly one output part, so wrap the method return in a simple array');
4054  // TODO: verify that it is not already wrapped!
4055  //foreach ($this->opData['output']['parts'] as $name => $type) {
4056  // $this->debug('wrap in element named ' . $name);
4057  //}
4058  $opParams = array($this->methodreturn);
4059  }
4060  $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams);
4061  $this->appendDebug($this->wsdl->getDebug());
4062  $this->wsdl->clearDebug();
4063  if($errstr = $this->wsdl->getError()){
4064  $this->debug('got wsdl error: '.$errstr);
4065  $this->fault('SOAP-ENV:Server', 'unable to serialize result');
4066  return;
4067  }
4068  } else {
4069  if (isset($this->methodreturn)) {
4070  $return_val = $this->serialize_val($this->methodreturn, 'return');
4071  } else {
4072  $return_val = '';
4073  $this->debug('in absence of WSDL, assume void return for backward compatibility');
4074  }
4075  }
4076  }
4077  $this->debug('return value:');
4078  $this->appendDebug($this->varDump($return_val));
4079 
4080  $this->debug('serializing response');
4081  if ($this->wsdl) {
4082  $this->debug('have WSDL for serialization: style is ' . $this->opData['style']);
4083  if ($this->opData['style'] == 'rpc') {
4084  $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']);
4085  if ($this->opData['output']['use'] == 'literal') {
4086  // 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
4087  $payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
4088  } else {
4089  $payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
4090  }
4091  } else {
4092  $this->debug('style is not rpc for serialization: assume document');
4093  $payload = $return_val;
4094  }
4095  } else {
4096  $this->debug('do not have WSDL for serialization: assume rpc/encoded');
4097  $payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
4098  }
4099  $this->result = 'successful';
4100  if($this->wsdl){
4101  //if($this->debug_flag){
4102  $this->appendDebug($this->wsdl->getDebug());
4103  // }
4104  if (isset($opData['output']['encodingStyle'])) {
4105  $encodingStyle = $opData['output']['encodingStyle'];
4106  } else {
4107  $encodingStyle = '';
4108  }
4109  // Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces.
4110  $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$this->opData['output']['use'],$encodingStyle);
4111  } else {
4112  $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders);
4113  }
4114  $this->debug("Leaving serialize_return");
4115  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:294
serializeEnvelope($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded')
serialize message
Definition: nusoap.php:417
& getDebug()
gets the current debug data for this instance
Definition: nusoap.php:319
parses a WSDL file, allows access to it&#39;s data, other utility methods
Definition: nusoap.php:3133
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4401
getError()
returns error string if present
Definition: nusoap.php:171
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
serialize_val($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
serializes PHP values in accordance w/ section 5.
Definition: nusoap.php:212
Create styles array
The data for the language used.
varDump($data)
Definition: nusoap.php:567
serializeRPCParameters($operation, $direction, $parameters)
serialize a PHP value according to a WSDL message definition
Definition: nusoap.php:3870
clearDebug()
clears the current debug data for this instance
Definition: nusoap.php:307
+ 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 3654 of file nusoap.php.

References $_SERVER, $data, nusoap_base\appendDebug(), nusoap_base\debug(), nusoap_base\getDebugAsXMLComment(), header, GuzzleHttp\Psr7\parse_request(), wsdl\serialize(), nusoap_base\varDump(), and wsdl\webDescription().

3654  {
3655  global $HTTP_SERVER_VARS;
3656 
3657  if (isset($_SERVER['QUERY_STRING'])) {
3658  $qs = $_SERVER['QUERY_STRING'];
3659  } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
3660  $qs = $HTTP_SERVER_VARS['QUERY_STRING'];
3661  } else {
3662  $qs = '';
3663  }
3664  $this->debug("In service, query string=$qs");
3665 
3666  if (preg_match('/wsdl/', $qs) ){
3667  $this->debug("In service, this is a request for WSDL");
3668  if($this->externalWSDLURL){
3669  if (strpos($this->externalWSDLURL,"://")!==false) { // assume URL
3670  header('Location: '.$this->externalWSDLURL);
3671  } else { // assume file
3672  header("Content-Type: text/xml\r\n");
3673  $fp = fopen($this->externalWSDLURL, 'r');
3674  fpassthru($fp);
3675  }
3676  } elseif ($this->wsdl) {
3677  header("Content-Type: text/xml; charset=ISO-8859-1\r\n");
3678  print $this->wsdl->serialize($this->debug_flag);
3679  if ($this->debug_flag) {
3680  $this->debug('wsdl:');
3681  $this->appendDebug($this->varDump($this->wsdl));
3682  print $this->getDebugAsXMLComment();
3683  }
3684  } else {
3685  header("Content-Type: text/html; charset=ISO-8859-1\r\n");
3686  print "This service does not provide WSDL";
3687  }
3688  } elseif ($data == '' && $this->wsdl) {
3689  $this->debug("In service, there is no data, so return Web description");
3690  print $this->wsdl->webDescription();
3691  } else {
3692  $this->debug("In service, invoke the request");
3693  $this->parse_request($data);
3694  if (! $this->fault) {
3695  $this->invoke_method();
3696  }
3697  if (! $this->fault) {
3698  $this->serialize_return();
3699  }
3700  $this->send_response();
3701  }
3702  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:294
& getDebugAsXMLComment()
gets the current debug data for this instance as an XML comment this may change the contents of the d...
Definition: nusoap.php:332
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
parses a WSDL file, allows access to it&#39;s data, other utility methods
Definition: nusoap.php:3133
send_response()
sends an HTTP response
Definition: nusoap.php:4127
serialize()
serialize the parsed wsdl
Definition: nusoap.php:3741
parse_request($data='')
parses a request
Definition: nusoap.php:3842
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4401
serialize_return()
serializes the return value from a PHP function into a full SOAP Envelope
Definition: nusoap.php:4035
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
invoke_method()
invokes a PHP function for the requested SOAP method
Definition: nusoap.php:3889
webDescription()
prints html description of services
Definition: nusoap.php:5238
Add a drawing to the header
Definition: 04printing.php:69
varDump($data)
Definition: nusoap.php:567
+ 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 4206 of file nusoap.php.

References wsdl\getOperationData().

4206  {
4207  if(isset($this->wsdl) && is_object($this->wsdl)){
4208  if($this->wsdl->getOperationData($operation)){
4209  return true;
4210  }
4211  } elseif(isset($this->operations[$operation])){
4212  return true;
4213  }
4214  return false;
4215  }
parses a WSDL file, allows access to it&#39;s data, other utility methods
Definition: nusoap.php:3133
getOperationData($operation, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:3679
+ Here is the call graph for this function:

Field Documentation

◆ $debug_flag

nusoap_server::$debug_flag = false

Definition at line 3581 of file nusoap.php.

◆ $decode_utf8

nusoap_server::$decode_utf8 = true

Definition at line 3506 of file nusoap.php.

◆ $document

nusoap_server::$document = ''

Definition at line 3464 of file nusoap.php.

◆ $externalWSDLURL

nusoap_server::$externalWSDLURL = false

Definition at line 3575 of file nusoap.php.

◆ $fault

nusoap_server::$fault = false

Definition at line 3549 of file nusoap.php.

◆ $headers

nusoap_server::$headers = array()

Definition at line 3440 of file nusoap.php.

◆ $methodname

nusoap_server::$methodname = ''

Definition at line 3482 of file nusoap.php.

◆ $methodparams

nusoap_server::$methodparams = array()

Definition at line 3488 of file nusoap.php.

◆ $methodreturn

nusoap_server::$methodreturn = false

Definition at line 3537 of file nusoap.php.

◆ $methodreturnisliteralxml

nusoap_server::$methodreturnisliteralxml = false

Definition at line 3543 of file nusoap.php.

◆ $methodURI

nusoap_server::$methodURI = ''

Definition at line 3476 of file nusoap.php.

◆ $operations

nusoap_server::$operations = array()

Definition at line 3563 of file nusoap.php.

◆ $outgoing_headers

nusoap_server::$outgoing_headers = array()

Definition at line 3513 of file nusoap.php.

◆ $request

nusoap_server::$request = ''

Definition at line 3446 of file nusoap.php.

◆ $requestHeader

nusoap_server::$requestHeader = NULL

Definition at line 3458 of file nusoap.php.

◆ $requestHeaders

nusoap_server::$requestHeaders = ''

Definition at line 3452 of file nusoap.php.

◆ $requestSOAP

nusoap_server::$requestSOAP = ''

Definition at line 3470 of file nusoap.php.

◆ $response

nusoap_server::$response = ''

Definition at line 3519 of file nusoap.php.

◆ $responseHeaders

nusoap_server::$responseHeaders = ''

Definition at line 3525 of file nusoap.php.

◆ $responseSOAP

nusoap_server::$responseSOAP = ''

Definition at line 3531 of file nusoap.php.

◆ $result

nusoap_server::$result = 'successful'

Definition at line 3555 of file nusoap.php.

◆ $SOAPAction

nusoap_server::$SOAPAction = ''

Definition at line 3494 of file nusoap.php.

◆ $wsdl

nusoap_server::$wsdl = false

Definition at line 3569 of file nusoap.php.

◆ $xml_encoding

nusoap_server::$xml_encoding = ''

Definition at line 3500 of file nusoap.php.


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