ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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...
 
 addInternalPort (string $serviceName, string $url)
 
- 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

 $opData
 
 $headers = array()
 
 $request = ''
 
 $requestHeaders = ''
 
 $requestHeader = null
 
 $document = ''
 
 $requestSOAP = ''
 
 $methodURI = ''
 
 $methodname = ''
 
 $methodparams = array()
 
 $SOAPAction = ''
 
 $xml_encoding = ''
 
 $decode_utf8 = true
 
 $class
 
 $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$ @access public

Definition at line 3475 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) @access public

Definition at line 3635 of file nusoap.php.

3636 {
3638 // turn on debugging?
3639 global $debug;
3640 global $HTTP_SERVER_VARS;
3641
3642 if (isset($_SERVER)) {
3643 $this->debug("_SERVER is defined:");
3644 $this->appendDebug($this->varDump($_SERVER));
3645 } elseif (isset($HTTP_SERVER_VARS)) {
3646 $this->debug("HTTP_SERVER_VARS is defined:");
3647 $this->appendDebug($this->varDump($HTTP_SERVER_VARS));
3648 } else {
3649 $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
3650 }
3651
3652 if (isset($debug)) {
3653 $this->debug("In nusoap_server, set debug_flag=$debug based on global flag");
3654 $this->debug_flag = $debug;
3655 } elseif (isset($_SERVER['QUERY_STRING'])) {
3656 $qs = explode('&', $_SERVER['QUERY_STRING']);
3657 foreach ($qs as $v) {
3658 if (substr($v, 0, 6) == 'debug=') {
3659 $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1");
3660 $this->debug_flag = substr($v, 6);
3661 }
3662 }
3663 } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
3664 $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']);
3665 foreach ($qs as $v) {
3666 if (substr($v, 0, 6) == 'debug=') {
3667 $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
3668 $this->debug_flag = substr($v, 6);
3669 }
3670 }
3671 }
3672
3673 // wsdl
3674 if ($wsdl) {
3675 $this->debug("In nusoap_server, WSDL is specified");
3676 if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) {
3677 $this->wsdl = $wsdl;
3678 $this->externalWSDLURL = $this->wsdl->wsdl;
3679 $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
3680 } else {
3681 $this->debug('Create wsdl from ' . $wsdl);
3682 $this->wsdl = new wsdl($wsdl);
3683 $this->externalWSDLURL = $wsdl;
3684 }
3685 $this->appendDebug($this->wsdl->getDebug());
3686 $this->wsdl->clearDebug();
3687 if ($err = $this->wsdl->getError()) {
3688 die('WSDL ERROR: ' . $err);
3689 }
3690 }
3691 }
& getDebug()
gets the current debug data for this instance
Definition: nusoap.php:290
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
clearDebug()
clears the current debug data for this instance
Definition: nusoap.php:277
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:867
getError()
returns error string if present
Definition: nusoap.php:339
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:263
parses a WSDL file, allows access to it's data, other utility methods.
Definition: nusoap.php:4582
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26

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

+ 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 @access public
Deprecated:

Definition at line 4371 of file nusoap.php.

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

References $methodname, and $out.

◆ addInternalPort()

nusoap_server::addInternalPort ( string  $serviceName,
string  $url 
)

Definition at line 4551 of file nusoap.php.

4551 : void
4552 {
4553 $this->wsdl->ports['Internal' . $serviceName . 'Port'] = [
4554 'binding' => $serviceName . 'Binding',
4555 'location' => (string) (new \ILIAS\Data\URI($url))->withQuery(),
4556 'bindingType' => 'http://schemas.xmlsoap.org/wsdl/soap/'
4557 ];
4558 }
if(empty($path)) $serviceName
Definition: ltiservices.php:37
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
$url
Definition: shib_logout.php:70

References $serviceName, and $url.

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

4480 ://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false)
4481 {
4482 global $HTTP_SERVER_VARS;
4483
4484 if (isset($_SERVER)) {
4485 $SERVER_NAME = $_SERVER['SERVER_NAME'];
4486 $SERVER_PORT = $_SERVER['SERVER_PORT'];
4487 $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
4488 $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
4489 } elseif (isset($HTTP_SERVER_VARS)) {
4490 $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
4491 $SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT'];
4492 $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
4493 $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
4494 } else {
4495 $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
4496 }
4497 // If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI)
4498 $colon = strpos($SERVER_NAME, ":");
4499 if ($colon) {
4500 $SERVER_NAME = substr($SERVER_NAME, 0, $colon);
4501 }
4502 if ($SERVER_PORT == 80) {
4503 $SERVER_PORT = '';
4504 } else {
4505 $SERVER_PORT = ':' . $SERVER_PORT;
4506 }
4507 if (false == $namespace) {
4508 $namespace = "http://$SERVER_NAME/soap/$serviceName";
4509 }
4510
4511 if (false == $endpoint) {
4512 if ($HTTPS == '1' || $HTTPS == 'on') {
4513 $SCHEME = 'https';
4514 } else {
4515 $SCHEME = 'http';
4516 }
4517 $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME";
4518 }
4519
4520 if (false == $schemaTargetNamespace) {
4521 $schemaTargetNamespace = $namespace;
4522 }
4523
4524 $this->wsdl = new wsdl();
4525 $this->wsdl->serviceName = $serviceName;
4526 $this->wsdl->endpoint = $endpoint;
4527 $this->wsdl->namespaces['tns'] = $namespace;
4528 $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/';
4529 $this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/';
4530 if ($schemaTargetNamespace != $namespace) {
4531 $this->wsdl->namespaces['types'] = $schemaTargetNamespace;
4532 }
4533 $this->wsdl->schemas[$schemaTargetNamespace][0] = new nusoap_xmlschema('', '', $this->wsdl->namespaces);
4534 if ($style == 'document') {
4535 $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified';
4536 }
4537 $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace;
4538 $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array('location' => '', 'loaded' => true);
4539 $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array('location' => '', 'loaded' => true);
4540 $this->wsdl->bindings[$serviceName . 'Binding'] = array(
4541 'name' => $serviceName . 'Binding',
4542 'style' => $style,
4543 'transport' => $transport,
4544 'portType' => $serviceName . 'PortType');
4545 $this->wsdl->ports[$serviceName . 'Port'] = array(
4546 'binding' => $serviceName . 'Binding',
4547 'location' => $endpoint,
4548 'bindingType' => 'http://schemas.xmlsoap.org/wsdl/soap/');
4549 }
setError($str)
sets error string
Definition: nusoap.php:353
parses an XML Schema, allows access to it's data, other utility methods.
Definition: nusoap.php:1086
if($err=$client->getError()) $namespace

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

+ 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$faultdetail@access public

Definition at line 4460 of file nusoap.php.

4461 {
4462 if ($faultdetail == '' && $this->debug_flag) {
4463 $faultdetail = $this->getDebug();
4464 }
4465 $this->fault = new nusoap_fault($faultcode, $faultactor, $faultstring, $faultdetail);
4466 $this->fault->soap_defencoding = $this->soap_defencoding;
4467 }
$soap_defencoding
Definition: nusoap.php:122
Contains information for a SOAP fault.
Definition: nusoap.php:994
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')
Specify a fault to be returned to the client.
Definition: nusoap.php:4460

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

Referenced by fault(), invoke_method(), parse_request(), parseRequest(), send_response(), serialize_return(), and service().

+ Here is the call graph for this function:
+ Here is the caller 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 @access private

Definition at line 4330 of file nusoap.php.

4331 {
4332 return $soapmsg;
4333 }

Referenced by send_response().

+ Here is the caller graph for this function:

◆ 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. @access private

Definition at line 4343 of file nusoap.php.

4344 {
4345 return 'text/xml';
4346 }

Referenced by send_response().

+ Here is the caller graph for this function:

◆ 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. @access private

Definition at line 4357 of file nusoap.php.

4358 {
4360 }

References nusoap_base\$soap_defencoding.

Referenced by send_response().

+ Here is the caller graph for this function:

◆ 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

@access private

Definition at line 3939 of file nusoap.php.

3940 {
3941 $this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction);
3942
3943 if ($this->wsdl) {
3944 if ($this->opData = $this->wsdl->getOperationData($this->methodname)) {
3945 $this->debug('in invoke_method, found WSDL operation=' . $this->methodname);
3946 $this->appendDebug('opData=' . $this->varDump($this->opData));
3947 } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) {
3948 // Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element
3949 $this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']);
3950 $this->appendDebug('opData=' . $this->varDump($this->opData));
3951 $this->methodname = $this->opData['name'];
3952 } else {
3953 $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname);
3954 $this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service");
3955 return;
3956 }
3957 } else {
3958 $this->debug('in invoke_method, no WSDL to validate method');
3959 }
3960
3961 // if a . is present in $this->methodname, we see if there is a class in scope,
3962 // which could be referred to. We will also distinguish between two deliminators,
3963 // to allow methods to be called a the class or an instance
3964 $class = '';
3965 $method = '';
3966 if (strpos($this->methodname, '..') > 0) {
3967 $delim = '..';
3968 } elseif (strpos($this->methodname, '.') > 0) {
3969 $delim = '.';
3970 } else {
3971 $delim = '';
3972 }
3973
3974 if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1 &&
3975 class_exists(substr($this->methodname, 0, strpos($this->methodname, $delim)))) {
3976 // get the class and method name
3977 $class = substr($this->methodname, 0, strpos($this->methodname, $delim));
3978 $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
3979 $this->debug("in invoke_method, class=$class method=$method delim=$delim");
3980 }
3981 // set class handler
3982 // added to support single operations
3983 if ($class == '' && $this->class != '') {
3985 $delim = "..";
3986 $method = $this->methodname;
3987 }
3988
3989 // does method exist?
3990 if ($class == '') {
3991 if (!function_exists($this->methodname)) {
3992 $this->debug("in invoke_method, function '$this->methodname' not found!");
3993 $this->result = 'fault: method not found';
3994 $this->fault('SOAP-ENV:Client', "method '$this->methodname' not defined in service");
3995 return;
3996 }
3997 } else {
3998 $method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method;
3999 if (!in_array($method_to_compare, get_class_methods($class))) {
4000 $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!");
4001 $this->result = 'fault: method not found';
4002 $this->fault('SOAP-ENV:Client', "method '$this->methodname' not defined in service");
4003 return;
4004 }
4005 }
4006
4007 // evaluate message, getting back parameters
4008 // verify that request parameters match the method's signature
4009 if (! $this->verify_method($this->methodname, $this->methodparams)) {
4010 // debug
4011 $this->debug('ERROR: request not verified against method signature');
4012 $this->result = 'fault: request failed validation against method signature';
4013 // return fault
4014 $this->fault('SOAP-ENV:Client', "Operation '$this->methodname' not defined in service.");
4015 return;
4016 }
4017
4018 // if there are parameters to pass
4019 $this->debug('in invoke_method, params:');
4020 $this->appendDebug($this->varDump($this->methodparams));
4021 $this->debug("in invoke_method, calling '$this->methodname'");
4022 if (!function_exists('call_user_func_array')) {
4023 if ($class == '') {
4024 $this->debug('in invoke_method, calling function using eval()');
4025 $funcCall = "\$this->methodreturn = $this->methodname(";
4026 } else {
4027 if ($delim == '..') {
4028 $this->debug('in invoke_method, calling class method using eval()');
4029 $funcCall = "\$this->methodreturn = " . $class . "::" . $method . "(";
4030 } else {
4031 $this->debug('in invoke_method, calling instance method using eval()');
4032 // generate unique instance name
4033 $instname = "\$inst_" . time();
4034 $funcCall = $instname . " = new " . $class . "(); ";
4035 $funcCall .= "\$this->methodreturn = " . $instname . "->" . $method . "(";
4036 }
4037 }
4038 if ($this->methodparams) {
4039 foreach ($this->methodparams as $param) {
4040 if (is_array($param) || is_object($param)) {
4041 $this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available');
4042 return;
4043 }
4044 $funcCall .= "\"$param\",";
4045 }
4046 $funcCall = substr($funcCall, 0, -1);
4047 }
4048 $funcCall .= ');';
4049 $this->debug('in invoke_method, function call: ' . $funcCall);
4050 @eval($funcCall);
4051 } else {
4052 if ($class == '') {
4053 $this->debug('in invoke_method, calling function using call_user_func_array()');
4054 $call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case after call_user_func_array()
4055 } elseif ($delim == '..') {
4056 $this->debug('in invoke_method, calling class method using call_user_func_array()');
4057 $call_arg = array($class, $method);
4058 } else {
4059 $this->debug('in invoke_method, calling instance method using call_user_func_array()');
4060 $instance = new $class();
4061 $call_arg = array(&$instance, $method);
4062 }
4063 if (is_array($this->methodparams)) {
4064 $this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams));
4065 } else {
4066 $this->methodreturn = call_user_func_array($call_arg, array());
4067 }
4068 }
4069 $this->debug('in invoke_method, methodreturn:');
4070 $this->appendDebug($this->varDump($this->methodreturn));
4071 $this->debug("in invoke_method, called method $this->methodname, received data of type " . gettype($this->methodreturn));
4072 }
verify_method($operation, $request)
takes the value that was created by parsing the request and compares to the method's signature,...
Definition: nusoap.php:4258
getOperationData($operation, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:5190
getOperationDataForSoapAction($soapAction, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:5222
$param
Definition: xapitoken.php:44

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

Referenced by service().

+ Here is the call graph for this function:
+ Here is the caller 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

@access private

Definition at line 3762 of file nusoap.php.

3763 {
3764 global $HTTP_SERVER_VARS;
3765
3766 $this->request = '';
3767 $this->SOAPAction = '';
3768 if (function_exists('getallheaders')) {
3769 $this->debug("In parse_http_headers, use getallheaders");
3770 $headers = getallheaders();
3771 foreach ($headers as $k => $v) {
3772 $k = strtolower($k);
3773 $this->headers[$k] = $v;
3774 $this->request .= "$k: $v\r\n";
3775 $this->debug("$k: $v");
3776 }
3777 // get SOAPAction header
3778 if (isset($this->headers['soapaction'])) {
3779 $this->SOAPAction = str_replace('"', '', $this->headers['soapaction']);
3780 }
3781 // get the character encoding of the incoming request
3782 if (isset($this->headers['content-type']) && strpos($this->headers['content-type'], '=')) {
3783 $enc = str_replace('"', '', substr(strstr($this->headers["content-type"], '='), 1));
3784 if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
3785 $this->xml_encoding = strtoupper($enc);
3786 } else {
3787 $this->xml_encoding = 'US-ASCII';
3788 }
3789 } else {
3790 // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
3791 $this->xml_encoding = 'ISO-8859-1';
3792 }
3793 } elseif (isset($_SERVER) && is_array($_SERVER)) {
3794 $this->debug("In parse_http_headers, use _SERVER");
3795 foreach ($_SERVER as $k => $v) {
3796 if (substr($k, 0, 5) == 'HTTP_') {
3797 $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5))));
3798 } else {
3799 $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k)));
3800 }
3801 if ($k == 'soapaction') {
3802 // get SOAPAction header
3803 $k = 'SOAPAction';
3804 $v = str_replace('"', '', $v);
3805 $v = str_replace('\\', '', $v);
3806 $this->SOAPAction = $v;
3807 } elseif ($k == 'content-type') {
3808 // get the character encoding of the incoming request
3809 if (strpos($v, '=')) {
3810 $enc = substr(strstr($v, '='), 1);
3811 $enc = str_replace('"', '', $enc);
3812 $enc = str_replace('\\', '', $enc);
3813 if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
3814 $this->xml_encoding = strtoupper($enc);
3815 } else {
3816 $this->xml_encoding = 'US-ASCII';
3817 }
3818 } else {
3819 // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
3820 $this->xml_encoding = 'ISO-8859-1';
3821 }
3822 }
3823 $this->headers[$k] = $v;
3824 $this->request .= "$k: $v\r\n";
3825 $this->debug("$k: $v");
3826 }
3827 } elseif (is_array($HTTP_SERVER_VARS)) {
3828 $this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
3829 foreach ($HTTP_SERVER_VARS as $k => $v) {
3830 if (substr($k, 0, 5) == 'HTTP_') {
3831 $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5))));
3832 $k = strtolower(substr($k, 5));
3833 } else {
3834 $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k)));
3835 $k = strtolower($k);
3836 }
3837 if ($k == 'soapaction') {
3838 // get SOAPAction header
3839 $k = 'SOAPAction';
3840 $v = str_replace('"', '', $v);
3841 $v = str_replace('\\', '', $v);
3842 $this->SOAPAction = $v;
3843 } elseif ($k == 'content-type') {
3844 // get the character encoding of the incoming request
3845 if (strpos($v, '=')) {
3846 $enc = substr(strstr($v, '='), 1);
3847 $enc = str_replace('"', '', $enc);
3848 $enc = str_replace('\\', '', $enc);
3849 if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
3850 $this->xml_encoding = strtoupper($enc);
3851 } else {
3852 $this->xml_encoding = 'US-ASCII';
3853 }
3854 } else {
3855 // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
3856 $this->xml_encoding = 'ISO-8859-1';
3857 }
3858 }
3859 $this->headers[$k] = $v;
3860 $this->request .= "$k: $v\r\n";
3861 $this->debug("$k: $v");
3862 }
3863 } else {
3864 $this->debug("In parse_http_headers, HTTP headers not accessible");
3865 $this->setError("HTTP headers not accessible");
3866 }
3867 }

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

Referenced by parse_request().

+ Here is the call graph for this function:
+ Here is the caller 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 @access private

Definition at line 3891 of file nusoap.php.

3892 {
3893 $this->debug('entering parse_request()');
3894 $this->parse_http_headers();
3895 $this->debug('got character encoding: ' . $this->xml_encoding);
3896 // uncompress if necessary
3897 if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') {
3898 $this->debug('got content encoding: ' . $this->headers['content-encoding']);
3899 if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') {
3900 // if decoding works, use it. else assume data wasn't gzencoded
3901 if (function_exists('gzuncompress')) {
3902 if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
3903 $data = $degzdata;
3904 } elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) {
3905 $data = $degzdata;
3906 } else {
3907 $this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data');
3908 return;
3909 }
3910 } else {
3911 $this->fault('SOAP-ENV:Client', 'This Server does not support compressed data');
3912 return;
3913 }
3914 }
3915 }
3916 $this->request .= "\r\n" . $data;
3917 $data = $this->parseRequest($this->headers, $data);
3918 $this->requestSOAP = $data;
3919 $this->debug('leaving parse_request');
3920 }
parse_http_headers()
parses HTTP request headers.
Definition: nusoap.php:3762
parseRequest($headers, $data)
processes SOAP message received from client
Definition: nusoap.php:4278

References $data, nusoap_base\debug(), fault(), parse_http_headers(), and parseRequest().

Referenced by service().

+ Here is the call graph for this function:
+ Here is the caller 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 @access private

Definition at line 4278 of file nusoap.php.

4279 {
4280 $this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' and type ' . $headers['content-type']);
4281 if (!strstr($headers['content-type'], 'text/xml')) {
4282 $this->setError('Request not of type text/xml');
4283 return false;
4284 }
4285 if (strpos($headers['content-type'], '=')) {
4286 $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
4287 $this->debug('Got response encoding: ' . $enc);
4288 if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
4289 $this->xml_encoding = strtoupper($enc);
4290 } else {
4291 $this->xml_encoding = 'US-ASCII';
4292 }
4293 } else {
4294 // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
4295 $this->xml_encoding = 'ISO-8859-1';
4296 }
4297 $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
4298 // parse response, get soap parser obj
4299 $parser = new nusoap_parser($data, $this->xml_encoding, '', $this->decode_utf8);
4300 // parser debug
4301 $this->debug("parser debug: \n" . $parser->getDebug());
4302 // if fault occurred during message parsing
4303 if ($err = $parser->getError()) {
4304 $this->result = 'fault: error in msg parsing: ' . $err;
4305 $this->fault('SOAP-ENV:Client', "error in msg parsing:\n" . $err);
4306 // else successfully parsed request into soapval object
4307 } else {
4308 // get/set methodname
4309 $this->methodURI = $parser->root_struct_namespace;
4310 $this->methodname = $parser->root_struct_name;
4311 $this->debug('methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);
4312 $this->debug('calling parser->get_soapbody()');
4313 $this->methodparams = $parser->get_soapbody();
4314 // get SOAP headers
4315 $this->requestHeaders = $parser->getHeaders();
4316 // get SOAP Header
4317 $this->requestHeader = $parser->get_soapheader();
4318 // add document for doclit support
4319 $this->document = $parser->document;
4320 }
4321 }
nusoap_parser class parses SOAP XML messages into native PHP values
Definition: nusoap.php:6514

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

Referenced by parse_request().

+ Here is the call graph for this function:
+ Here is the caller 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) @access public

Definition at line 4390 of file nusoap.php.

4391 {
4392 global $HTTP_SERVER_VARS;
4393
4394 if ($this->externalWSDLURL) {
4395 die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.');
4396 }
4397 if (! $name) {
4398 die('You must specify a name when you register an operation');
4399 }
4400 if (!is_array($in)) {
4401 die('You must provide an array for operation inputs');
4402 }
4403 if (!is_array($out)) {
4404 die('You must provide an array for operation outputs');
4405 }
4406 if (false == $namespace) {
4407 }
4408 if (false == $soapaction) {
4409 if (isset($_SERVER)) {
4410 $SERVER_NAME = $_SERVER['SERVER_NAME'];
4411 $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
4412 $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off');
4413 } elseif (isset($HTTP_SERVER_VARS)) {
4414 $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
4415 $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
4416 $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off';
4417 } else {
4418 $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
4419 }
4420 if ($HTTPS == '1' || $HTTPS == 'on') {
4421 $SCHEME = 'https';
4422 } else {
4423 $SCHEME = 'http';
4424 }
4425 $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name";
4426 }
4427 if (false == $style) {
4428 $style = "rpc";
4429 }
4430 if (false == $use) {
4431 $use = "encoded";
4432 }
4433 if ($use == 'encoded' && $encodingStyle = '') {
4434 $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
4435 }
4436
4437 $this->operations[$name] = array(
4438 'name' => $name,
4439 'in' => $in,
4440 'out' => $out,
4441 'namespace' => $namespace,
4442 'soapaction' => $soapaction,
4443 'style' => $style);
4444 if ($this->wsdl) {
4445 $this->wsdl->addOperation($name, $in, $out, $namespace, $soapaction, $style, $use, $documentation, $encodingStyle);
4446 }
4447 return true;
4448 }
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:6428

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

+ 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

@access private

Definition at line 4178 of file nusoap.php.

4179 {
4180 $this->debug('Enter send_response');
4181 if ($this->fault) {
4182 $payload = $this->fault->serialize();
4183 $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error";
4184 $this->outgoing_headers[] = "Status: 500 Internal Server Error";
4185 } else {
4187 // Some combinations of PHP+Web server allow the Status
4188 // to come through as a header. Since OK is the default
4189 // just do nothing.
4190 // $this->outgoing_headers[] = "HTTP/1.0 200 OK";
4191 // $this->outgoing_headers[] = "Status: 200 OK";
4192 }
4193 // add debug data if in debug mode
4194 if (isset($this->debug_flag) && $this->debug_flag) {
4195 $payload .= $this->getDebugAsXMLComment();
4196 }
4197 $this->outgoing_headers[] = "Server: $this->title Server v$this->version";
4198 preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
4199 $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (" . $rev[1] . ")";
4200 // Let the Web server decide about this
4201 //$this->outgoing_headers[] = "Connection: Close\r\n";
4202 $payload = $this->getHTTPBody($payload);
4203 $type = $this->getHTTPContentType();
4204 $charset = $this->getHTTPContentTypeCharset();
4205 $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : '');
4206 //begin code to compress payload - by John
4207 // NOTE: there is no way to know whether the Web server will also compress
4208 // this data.
4209 if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) {
4210 if (strstr($this->headers['accept-encoding'], 'gzip')) {
4211 if (function_exists('gzencode')) {
4212 if (isset($this->debug_flag) && $this->debug_flag) {
4213 $payload .= "<!-- Content being gzipped -->";
4214 }
4215 $this->outgoing_headers[] = "Content-Encoding: gzip";
4216 $payload = gzencode($payload);
4217 } else {
4218 if (isset($this->debug_flag) && $this->debug_flag) {
4219 $payload .= "<!-- Content will not be gzipped: no gzencode -->";
4220 }
4221 }
4222 } elseif (strstr($this->headers['accept-encoding'], 'deflate')) {
4223 // Note: MSIE requires gzdeflate output (no Zlib header and checksum),
4224 // instead of gzcompress output,
4225 // which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5)
4226 if (function_exists('gzdeflate')) {
4227 if (isset($this->debug_flag) && $this->debug_flag) {
4228 $payload .= "<!-- Content being deflated -->";
4229 }
4230 $this->outgoing_headers[] = "Content-Encoding: deflate";
4231 $payload = gzdeflate($payload);
4232 } else {
4233 if (isset($this->debug_flag) && $this->debug_flag) {
4234 $payload .= "<!-- Content will not be deflated: no gzcompress -->";
4235 }
4236 }
4237 }
4238 }
4239 //end code
4240 $this->outgoing_headers[] = "Content-Length: " . strlen($payload);
4241 reset($this->outgoing_headers);
4242 foreach ($this->outgoing_headers as $hdr) {
4243 header($hdr, false);
4244 }
4245 print $payload;
4246 $this->response = join("\r\n", $this->outgoing_headers) . "\r\n\r\n" . $payload;
4247 }
& getDebugAsXMLComment()
gets the current debug data for this instance as an XML comment this may change the contents of the d...
Definition: nusoap.php:304
getHTTPBody($soapmsg)
gets the HTTP body for the current response.
Definition: nusoap.php:4330
getHTTPContentType()
gets the HTTP content type for the current response.
Definition: nusoap.php:4343
getHTTPContentTypeCharset()
gets the HTTP content type charset for the current response.
Definition: nusoap.php:4357
if(count($parts) !=3) $payload
Definition: ltitoken.php:67

References $debug_flag, $payload, $responseSOAP, nusoap_base\debug(), fault(), nusoap_base\getDebugAsXMLComment(), getHTTPBody(), getHTTPContentType(), getHTTPContentTypeCharset(), and ILIAS\UI\examples\Symbol\Glyph\Header\header().

Referenced by service().

+ Here is the call graph for this function:
+ Here is the caller 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

@access private

Definition at line 4085 of file nusoap.php.

4086 {
4087 $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);
4088 // if fault
4089 if (isset($this->methodreturn) && ((get_class((object) $this->methodreturn) == 'soap_fault') || (get_class((object) $this->methodreturn) == 'nusoap_fault'))) {
4090 $this->debug('got a fault object from method');
4091 $this->fault = $this->methodreturn;
4092 return;
4093 } elseif ($this->methodreturnisliteralxml) {
4094 $return_val = $this->methodreturn;
4095 // returned value(s)
4096 } else {
4097 $this->debug('got a(n) ' . gettype($this->methodreturn) . ' from method');
4098 $this->debug('serializing return value');
4099 if ($this->wsdl) {
4100 if (sizeof($this->opData['output']['parts']) > 1) {
4101 $this->debug('more than one output part, so use the method return unchanged');
4102 $opParams = $this->methodreturn;
4103 } elseif (sizeof($this->opData['output']['parts']) == 1) {
4104 $this->debug('exactly one output part, so wrap the method return in a simple array');
4105 // TODO: verify that it is not already wrapped!
4106 //foreach ($this->opData['output']['parts'] as $name => $type) {
4107 // $this->debug('wrap in element named ' . $name);
4108 //}
4109 $opParams = array($this->methodreturn);
4110 }
4111 $return_val = $this->wsdl->serializeRPCParameters($this->methodname, 'output', $opParams);
4112 $this->appendDebug($this->wsdl->getDebug());
4113 $this->wsdl->clearDebug();
4114 if ($errstr = $this->wsdl->getError()) {
4115 $this->debug('got wsdl error: ' . $errstr);
4116 $this->fault('SOAP-ENV:Server', 'unable to serialize result');
4117 return;
4118 }
4119 } else {
4120 if (isset($this->methodreturn)) {
4121 $return_val = $this->serialize_val($this->methodreturn, 'return');
4122 } else {
4123 $return_val = '';
4124 $this->debug('in absence of WSDL, assume void return for backward compatibility');
4125 }
4126 }
4127 }
4128 $this->debug('return value:');
4129 $this->appendDebug($this->varDump($return_val));
4130
4131 $this->debug('serializing response');
4132 if ($this->wsdl) {
4133 $this->debug('have WSDL for serialization: style is ' . $this->opData['style']);
4134 if ($this->opData['style'] == 'rpc') {
4135 $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']);
4136 if ($this->opData['output']['use'] == 'literal') {
4137 // 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
4138 $payload = '<ns1:' . $this->methodname . 'Response xmlns:ns1="' . $this->methodURI . '">' . $return_val . '</ns1:' . $this->methodname . "Response>";
4139 } else {
4140 $payload = '<ns1:' . $this->methodname . 'Response xmlns:ns1="' . $this->methodURI . '">' . $return_val . '</ns1:' . $this->methodname . "Response>";
4141 }
4142 } else {
4143 $this->debug('style is not rpc for serialization: assume document');
4144 $payload = $return_val;
4145 }
4146 } else {
4147 $this->debug('do not have WSDL for serialization: assume rpc/encoded');
4148 $payload = '<ns1:' . $this->methodname . 'Response xmlns:ns1="' . $this->methodURI . '">' . $return_val . '</ns1:' . $this->methodname . "Response>";
4149 }
4150 $this->result = 'successful';
4151 if ($this->wsdl) {
4152 //if($this->debug_flag){
4153 $this->appendDebug($this->wsdl->getDebug());
4154 // }
4155 if (isset($opData['output']['encodingStyle'])) {
4156 $encodingStyle = $opData['output']['encodingStyle'];
4157 } else {
4158 $encodingStyle = '';
4159 }
4160 // Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces.
4161 $this->responseSOAP = $this->serializeEnvelope($payload, $this->responseHeaders, $this->wsdl->usedNamespaces, $this->opData['style'], $this->opData['output']['use'], $encodingStyle);
4162 } else {
4163 $this->responseSOAP = $this->serializeEnvelope($payload, $this->responseHeaders);
4164 }
4165 $this->debug("Leaving serialize_return");
4166 }
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:391
serializeEnvelope($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded', $encodingStyle='http://schemas.xmlsoap.org/soap/encoding/')
serializes a message
Definition: nusoap.php:658
serializeRPCParameters($operation, $direction, $parameters, $bindingType='soap')
serialize PHP values according to a WSDL message definition contrary to the method name,...
Definition: nusoap.php:5702

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

Referenced by service().

+ Here is the call graph for this function:
+ Here is the caller 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 @access public

Definition at line 3699 of file nusoap.php.

3700 {
3701 global $HTTP_SERVER_VARS;
3702
3703 if (isset($_SERVER['QUERY_STRING'])) {
3704 $qs = $_SERVER['QUERY_STRING'];
3705 } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
3706 $qs = $HTTP_SERVER_VARS['QUERY_STRING'];
3707 } else {
3708 $qs = '';
3709 }
3710 $this->debug("In service, query string=$qs");
3711
3712 if (preg_match('/wsdl/', $qs)) {
3713 $this->debug("In service, this is a request for WSDL");
3714 if ($this->externalWSDLURL) {
3715 if (strpos($this->externalWSDLURL, "://") !== false) { // assume URL
3716 header('Location: ' . $this->externalWSDLURL);
3717 } else { // assume file
3718 header("Content-Type: text/xml\r\n");
3719 $fp = fopen($this->externalWSDLURL, 'r');
3720 fpassthru($fp);
3721 }
3722 } elseif ($this->wsdl) {
3723 header("Content-Type: text/xml; charset=ISO-8859-1\r\n");
3724 print $this->wsdl->serialize($this->debug_flag);
3725 if ($this->debug_flag) {
3726 $this->debug('wsdl:');
3727 $this->appendDebug($this->varDump($this->wsdl));
3728 print $this->getDebugAsXMLComment();
3729 }
3730 } else {
3731 header("Content-Type: text/html; charset=ISO-8859-1\r\n");
3732 print "This service does not provide WSDL";
3733 }
3734 } elseif ($data == '' && $this->wsdl) {
3735 $this->debug("In service, there is no data, so return Web description");
3736 print $this->wsdl->webDescription();
3737 } else {
3738 $this->debug("In service, invoke the request");
3739 $this->parse_request($data);
3740 if (! $this->fault) {
3741 $this->invoke_method();
3742 }
3743 if (! $this->fault) {
3744 $this->serialize_return();
3745 }
3746 $this->send_response();
3747 }
3748 }
invoke_method()
invokes a PHP function for the requested SOAP method
Definition: nusoap.php:3939
parse_request($data='')
parses a request
Definition: nusoap.php:3891
serialize_return()
serializes the return value from a PHP function into a full SOAP Envelope
Definition: nusoap.php:4085
send_response()
sends an HTTP response
Definition: nusoap.php:4178
serialize($debug=0)
serialize the parsed wsdl
Definition: nusoap.php:5460
webDescription()
prints html description of services
Definition: nusoap.php:5318

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

+ 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 @access private

Definition at line 4258 of file nusoap.php.

4259 {
4260 if (isset($this->wsdl) && is_object($this->wsdl)) {
4261 if ($this->wsdl->getOperationData($operation)) {
4262 return true;
4263 }
4264 } elseif (isset($this->operations[$operation])) {
4265 return true;
4266 }
4267 return false;
4268 }

References wsdl\getOperationData().

Referenced by invoke_method().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $class

nusoap_server::$class

Definition at line 3550 of file nusoap.php.

Referenced by invoke_method().

◆ $debug_flag

nusoap_server::$debug_flag = false

Definition at line 3625 of file nusoap.php.

Referenced by send_response().

◆ $decode_utf8

nusoap_server::$decode_utf8 = true

Definition at line 3549 of file nusoap.php.

◆ $document

nusoap_server::$document = ''

Definition at line 3507 of file nusoap.php.

◆ $externalWSDLURL

nusoap_server::$externalWSDLURL = false

Definition at line 3619 of file nusoap.php.

◆ $fault

nusoap_server::$fault = false

Definition at line 3593 of file nusoap.php.

◆ $headers

nusoap_server::$headers = array()

Definition at line 3483 of file nusoap.php.

Referenced by parse_http_headers(), and parseRequest().

◆ $methodname

nusoap_server::$methodname = ''

Definition at line 3525 of file nusoap.php.

Referenced by add_to_map(), and invoke_method().

◆ $methodparams

nusoap_server::$methodparams = array()

Definition at line 3531 of file nusoap.php.

◆ $methodreturn

nusoap_server::$methodreturn = false

Definition at line 3581 of file nusoap.php.

Referenced by serialize_return().

◆ $methodreturnisliteralxml

nusoap_server::$methodreturnisliteralxml = false

Definition at line 3587 of file nusoap.php.

◆ $methodURI

nusoap_server::$methodURI = ''

Definition at line 3519 of file nusoap.php.

◆ $opData

nusoap_server::$opData

Definition at line 3477 of file nusoap.php.

Referenced by serialize_return().

◆ $operations

nusoap_server::$operations = array()

Definition at line 3607 of file nusoap.php.

◆ $outgoing_headers

nusoap_server::$outgoing_headers = array()

Definition at line 3557 of file nusoap.php.

◆ $request

nusoap_server::$request = ''

Definition at line 3489 of file nusoap.php.

◆ $requestHeader

nusoap_server::$requestHeader = null

Definition at line 3501 of file nusoap.php.

◆ $requestHeaders

nusoap_server::$requestHeaders = ''

Definition at line 3495 of file nusoap.php.

◆ $requestSOAP

nusoap_server::$requestSOAP = ''

Definition at line 3513 of file nusoap.php.

◆ $response

nusoap_server::$response = ''

Definition at line 3563 of file nusoap.php.

◆ $responseHeaders

nusoap_server::$responseHeaders = ''

Definition at line 3569 of file nusoap.php.

◆ $responseSOAP

nusoap_server::$responseSOAP = ''

Definition at line 3575 of file nusoap.php.

Referenced by send_response().

◆ $result

nusoap_server::$result = 'successful'

Definition at line 3599 of file nusoap.php.

◆ $SOAPAction

nusoap_server::$SOAPAction = ''

Definition at line 3537 of file nusoap.php.

◆ $wsdl

nusoap_server::$wsdl = false

Definition at line 3613 of file nusoap.php.

Referenced by __construct().

◆ $xml_encoding

nusoap_server::$xml_encoding = ''

Definition at line 3543 of file nusoap.php.


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