ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
wsdl Class Reference

parses a WSDL file, allows access to it's data, other utility methods. More...

+ Inheritance diagram for wsdl:
+ Collaboration diagram for wsdl:

Public Member Functions

 __construct ($wsdl='', $proxyhost=false, $proxyport=false, $proxyusername=false, $proxypassword=false, $timeout=0, $response_timeout=30, $curl_options=null, $use_curl=false)
 constructor More...
 
 fetchWSDL ($wsdl)
 fetches the WSDL document and parses it More...
 
 parseWSDL ($wsdl='')
 parses the wsdl document More...
 
 start_element ($parser, $name, $attrs)
 start-element handler More...
 
 end_element ($parser, $name)
 end-element handler More...
 
 character_data ($parser, $data)
 element content handler More...
 
 setCredentials ($username, $password, $authtype='basic', $certRequest=array())
 if authenticating, set user credentials here More...
 
 getBindingData ($binding)
 
 getOperations ($bindingType='soap')
 returns an assoc array of operation names => operation data More...
 
 getOperationData ($operation, $bindingType='soap')
 returns an associative array of data necessary for calling an operation More...
 
 getOperationDataForSoapAction ($soapAction, $bindingType='soap')
 returns an associative array of data necessary for calling an operation More...
 
 getTypeDef ($type, $ns)
 returns an array of information about a given type returns false if no type exists by the given name More...
 
 webDescription ()
 prints html description of services More...
 
 serialize ($debug=0)
 serialize the parsed wsdl More...
 
 parametersMatchWrapped ($type, &$parameters)
 determine whether a set of parameters are unwrapped when they are expect to be wrapped, Microsoft-style. More...
 
 serializeRPCParameters ($operation, $direction, $parameters, $bindingType='soap')
 serialize PHP values according to a WSDL message definition contrary to the method name, this is not limited to RPC More...
 
 serializeParameters ($operation, $direction, $parameters)
 serialize a PHP value according to a WSDL message definition More...
 
 serializeType ($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
 serializes a PHP value according a given type definition More...
 
 serializeComplexTypeAttributes ($typeDef, $value, $ns, $uqType)
 serializes the attributes for a complexType More...
 
 serializeComplexTypeElements ($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false)
 serializes the elements for a complexType More...
 
 addComplexType ($name, $typeClass='complexType', $phpType='array', $compositor='', $restrictionBase='', $elements=array(), $attrs=array(), $arrayType='')
 adds an XML Schema complex type to the WSDL types More...
 
 addSimpleType ($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array())
 adds an XML Schema simple type to the WSDL types More...
 
 addElement ($attrs)
 adds an element to the WSDL types More...
 
 addOperation ($name, $in=false, $out=false, $namespace=false, $soapaction=false, $style='rpc', $use='encoded', $documentation='', $encodingStyle='')
 register an operation with the server More...
 
- Public Member Functions inherited from nusoap_base
 __construct ()
 constructor More...
 
 getGlobalDebugLevel ()
 gets the global debug level, which applies to future instances More...
 
 setGlobalDebugLevel ($level)
 sets the global debug level, which applies to future instances More...
 
 getDebugLevel ()
 gets the debug level for this instance More...
 
 setDebugLevel ($level)
 sets the debug level for this instance More...
 
 debug ($string)
 adds debug data to the instance debug string with formatting More...
 
 appendDebug ($string)
 adds debug data to the instance debug string without formatting More...
 
 clearDebug ()
 clears the current debug data for this instance More...
 
getDebug ()
 gets the current debug data for this instance More...
 
getDebugAsXMLComment ()
 gets the current debug data for this instance as an XML comment this may change the contents of the debug data More...
 
 expandEntities ($val)
 expands entities, e.g. More...
 
 getError ()
 returns error string if present More...
 
 setError ($str)
 sets error string More...
 
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array) More...
 
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded', $soapval=false)
 serializes PHP values in accordance w/ section 5. More...
 
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded', $encodingStyle='http://schemas.xmlsoap.org/soap/encoding/')
 serializes a message More...
 
 formatDump ($str)
 formats a string to be inserted into an HTML stream More...
 
 contractQname ($qname)
 contracts (changes namespace to prefix) a qualified name More...
 
 expandQname ($qname)
 expands (changes prefix to namespace) a qualified name More...
 
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed More...
 
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed More...
 
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace More...
 
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace More...
 
 getmicrotime ()
 returns the time in ODBC canonical form with microseconds More...
 
 varDump ($data)
 Returns a string with the output of var_dump. More...
 
 __toString ()
 represents the object as a string More...
 

Data Fields

 $serviceName
 
 $opStatus
 
 $currentPortOperation
 
 $wsdl
 
 $schemas = array()
 
 $currentSchema
 
 $message = array()
 
 $complexTypes = array()
 
 $messages = array()
 
 $currentMessage
 
 $currentOperation
 
 $portTypes = array()
 
 $currentPortType
 
 $bindings = array()
 
 $currentBinding
 
 $ports = array()
 
 $currentPort
 
 $opData = array()
 
 $status = ''
 
 $documentation = false
 
 $endpoint = ''
 
 $import = array()
 
 $parser
 
 $position = 0
 
 $depth = 0
 
 $depth_array = array()
 
 $proxyhost = ''
 
 $proxyport = ''
 
 $proxyusername = ''
 
 $proxypassword = ''
 
 $timeout = 0
 
 $response_timeout = 30
 
 $curl_options = array()
 
 $use_curl = false
 
 $username = ''
 
 $password = ''
 
 $authtype = ''
 
 $certRequest = array()
 
- 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

parses a WSDL file, allows access to it's data, other utility methods.

also builds WSDL structures programmatically.

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

Constructor & Destructor Documentation

◆ __construct()

wsdl::__construct (   $wsdl = '',
  $proxyhost = false,
  $proxyport = false,
  $proxyusername = false,
  $proxypassword = false,
  $timeout = 0,
  $response_timeout = 30,
  $curl_options = null,
  $use_curl = false 
)

constructor

Parameters
string$wsdlWSDL document URL
string$proxyhost
string$proxyport
string$proxyusername
string$proxypassword
integer$timeoutset the connection timeout
integer$response_timeoutset the response timeout
array$curl_optionsuser-specified cURL options
boolean$use_curltry to use cURL public

Definition at line 4648 of file nusoap.php.

References ILIAS\GlobalScreen\Provider\__construct(), and nusoap_base\debug().

4649  {
4651  $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
4652  $this->proxyhost = $proxyhost;
4653  $this->proxyport = $proxyport;
4654  $this->proxyusername = $proxyusername;
4655  $this->proxypassword = $proxypassword;
4656  $this->timeout = $timeout;
4657  $this->response_timeout = $response_timeout;
4658  if (is_array($curl_options)) {
4659  $this->curl_options = $curl_options;
4660  }
4661  $this->use_curl = $use_curl;
4662  $this->fetchWSDL($wsdl);
4663  }
$proxyhost
Definition: nusoap.php:4620
$wsdl
Definition: nusoap.php:4593
$use_curl
Definition: nusoap.php:4627
$proxyusername
Definition: nusoap.php:4622
$curl_options
Definition: nusoap.php:4626
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
$proxyport
Definition: nusoap.php:4621
$response_timeout
Definition: nusoap.php:4625
$timeout
Definition: nusoap.php:4624
__construct(Container $dic, ilPlugin $plugin)
fetchWSDL($wsdl)
fetches the WSDL document and parses it
Definition: nusoap.php:4670
$proxypassword
Definition: nusoap.php:4623
+ Here is the call graph for this function:

Member Function Documentation

◆ addComplexType()

wsdl::addComplexType (   $name,
  $typeClass = 'complexType',
  $phpType = 'array',
  $compositor = '',
  $restrictionBase = '',
  $elements = array(),
  $attrs = array(),
  $arrayType = '' 
)

adds an XML Schema complex type to the WSDL types

Parameters
string$name
string$typeClass(complexType|simpleType|attribute)
string$phpTypecurrently supported are array and struct (php assoc array)
string$compositor(all|sequence|choice)
string$restrictionBasenamespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
array$elementse.g. array ( name => array(name=>'',type=>'') )
array$attrse.g. array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]'))
string$arrayTypeas namespace:name (xsd:string)
See also
nusoap_xmlschema public

Definition at line 6353 of file nusoap.php.

References Vendor\Package\$a, Vendor\Package\$e, and nusoap_base\expandQname().

6354  {
6355  if (count($elements) > 0) {
6356  $eElements = array();
6357  foreach ($elements as $n => $e) {
6358  // expand each element
6359  $ee = array();
6360  foreach ($e as $k => $v) {
6361  $k = strpos($k, ':') ? $this->expandQname($k) : $k;
6362  $v = strpos($v, ':') ? $this->expandQname($v) : $v;
6363  $ee[$k] = $v;
6364  }
6365  $eElements[$n] = $ee;
6366  }
6367  $elements = $eElements;
6368  }
6369 
6370  if (count($attrs) > 0) {
6371  foreach ($attrs as $n => $a) {
6372  // expand each attribute
6373  foreach ($a as $k => $v) {
6374  $k = strpos($k, ':') ? $this->expandQname($k) : $k;
6375  $v = strpos($v, ':') ? $this->expandQname($v) : $v;
6376  $aa[$k] = $v;
6377  }
6378  $eAttrs[$n] = $aa;
6379  }
6380  $attrs = $eAttrs;
6381  }
6382 
6383  $restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase;
6384  $arrayType = strpos($arrayType, ':') ? $this->expandQname($arrayType) : $arrayType;
6385 
6386  $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6387  $this->schemas[$typens][0]->addComplexType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs, $arrayType);
6388  }
expandQname($qname)
expands (changes prefix to namespace) a qualified name
Definition: nusoap.php:753
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
+ Here is the call graph for this function:

◆ addElement()

wsdl::addElement (   $attrs)

adds an element to the WSDL types

Parameters
array$attrsattributes that must include name and type
See also
nusoap_xmlschema public

Definition at line 6416 of file nusoap.php.

6417  {
6418  $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6419  $this->schemas[$typens][0]->addElement($attrs);
6420  }

◆ addOperation()

wsdl::addOperation (   $name,
  $in = false,
  $out = false,
  $namespace = false,
  $soapaction = false,
  $style = 'rpc',
  $use = 'encoded',
  $documentation = '',
  $encodingStyle = '' 
)

register an operation with the server

Parameters
string$nameoperation (method) name
array$inassoc array of input values: key = param name, value = param type
array$outassoc array of output values: key = param name, value = param type
string$namespaceoptional The namespace for the operation
string$soapactionoptional The soapaction for the operation
string$style(rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically
string$use(encoded|literal) optional The use for the parameters (cannot mix right now)
string$documentationoptional The description to include in the WSDL
string$encodingStyleoptional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) public

Definition at line 6436 of file nusoap.php.

References $namespace, $out, nusoap_base\getLocalPart(), nusoap_base\getNamespaceFromPrefix(), and nusoap_base\getPrefix().

Referenced by nusoap_server\register().

6437  {
6438  if ($use == 'encoded' && $encodingStyle == '') {
6439  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
6440  }
6441 
6442  if ($style == 'document') {
6443  $elements = array();
6444  foreach ($in as $n => $t) {
6445  $elements[$n] = array('name' => $n, 'type' => $t);
6446  }
6447  $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements);
6448  $this->addElement(array('name' => $name, 'type' => $name . 'RequestType'));
6449  $in = array('parameters' => 'tns:' . $name . '^');
6450 
6451  $elements = array();
6452  foreach ($out as $n => $t) {
6453  $elements[$n] = array('name' => $n, 'type' => $t);
6454  }
6455  $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements);
6456  $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified'));
6457  $out = array('parameters' => 'tns:' . $name . 'Response' . '^');
6458  }
6459 
6460  // get binding
6461  $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] =
6462  array(
6463  'name' => $name,
6464  'binding' => $this->serviceName . 'Binding',
6465  'endpoint' => $this->endpoint,
6466  'soapAction' => $soapaction,
6467  'style' => $style,
6468  'input' => array(
6469  'use' => $use,
6470  'namespace' => $namespace,
6471  'encodingStyle' => $encodingStyle,
6472  'message' => $name . 'Request',
6473  'parts' => $in),
6474  'output' => array(
6475  'use' => $use,
6476  'namespace' => $namespace,
6477  'encodingStyle' => $encodingStyle,
6478  'message' => $name . 'Response',
6479  'parts' => $out),
6480  'namespace' => $namespace,
6481  'transport' => 'http://schemas.xmlsoap.org/soap/http',
6482  'documentation' => $documentation);
6483  // add portTypes
6484  // add messages
6485  if ($in) {
6486  foreach ($in as $pName => $pType) {
6487  if (strpos($pType, ':')) {
6488  $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)) . ":" . $this->getLocalPart($pType);
6489  }
6490  $this->messages[$name . 'Request'][$pName] = $pType;
6491  }
6492  } else {
6493  $this->messages[$name . 'Request'] = '0';
6494  }
6495  if ($out) {
6496  foreach ($out as $pName => $pType) {
6497  if (strpos($pType, ':')) {
6498  $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)) . ":" . $this->getLocalPart($pType);
6499  }
6500  $this->messages[$name . 'Response'][$pName] = $pType;
6501  }
6502  } else {
6503  $this->messages[$name . 'Response'] = '0';
6504  }
6505  return true;
6506  }
if($err=$client->getError()) $namespace
addComplexType($name, $typeClass='complexType', $phpType='array', $compositor='', $restrictionBase='', $elements=array(), $attrs=array(), $arrayType='')
adds an XML Schema complex type to the WSDL types
Definition: nusoap.php:6353
$documentation
Definition: nusoap.php:4610
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:779
addElement($attrs)
adds an element to the WSDL types
Definition: nusoap.php:6416
$out
Definition: buildRTE.php:24
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:797
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:813
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSimpleType()

wsdl::addSimpleType (   $name,
  $restrictionBase = '',
  $typeClass = 'simpleType',
  $phpType = 'scalar',
  $enumeration = array() 
)

adds an XML Schema simple type to the WSDL types

Parameters
string$name
string$restrictionBasenamespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
string$typeClass(should always be simpleType)
string$phpType(should always be scalar)
array$enumerationarray of values
See also
nusoap_xmlschema public

Definition at line 6401 of file nusoap.php.

References nusoap_base\expandQname().

6402  {
6403  $restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase;
6404 
6405  $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6406  $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration);
6407  }
expandQname($qname)
expands (changes prefix to namespace) a qualified name
Definition: nusoap.php:753
+ Here is the call graph for this function:

◆ character_data()

wsdl::character_data (   $parser,
  $data 
)

element content handler

Parameters
string$parserXML parser object
string$dataelement content private

Definition at line 5122 of file nusoap.php.

References $data.

5123  {
5124  $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
5125  if (isset($this->message[$pos]['cdata'])) {
5126  $this->message[$pos]['cdata'] .= $data;
5127  }
5128  if ($this->documentation) {
5129  $this->documentation .= $data;
5130  }
5131  }
$depth
Definition: nusoap.php:4617

◆ end_element()

wsdl::end_element (   $parser,
  $name 
)

end-element handler

Parameters
string$parserXML parser object
string$nameelement name private

Definition at line 5091 of file nusoap.php.

References nusoap_base\appendDebug(), and nusoap_base\debug().

5092  {
5093  // unset schema status
5094  if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) {
5095  $this->status = "";
5096  $this->appendDebug($this->currentSchema->getDebug());
5097  $this->currentSchema->clearDebug();
5098  $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
5099  $this->debug('Parsing WSDL schema done');
5100  }
5101  if ($this->status == 'schema') {
5102  $this->currentSchema->schemaEndElement($parser, $name);
5103  } else {
5104  // bring depth down a notch
5105  $this->depth--;
5106  }
5107  // end documentation
5108  if ($this->documentation) {
5109  //TODO: track the node to which documentation should be assigned; it can be a part, message, etc.
5110  //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation;
5111  $this->documentation = false;
5112  }
5113  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:263
$currentSchema
Definition: nusoap.php:4596
$parser
Definition: nusoap.php:4615
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
+ Here is the call graph for this function:

◆ fetchWSDL()

wsdl::fetchWSDL (   $wsdl)

fetches the WSDL document and parses it

public

Definition at line 4670 of file nusoap.php.

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

Referenced by nusoap_client\loadWSDL().

4671  {
4672  $this->debug("parse and process WSDL path=$wsdl");
4673  $this->wsdl = $wsdl;
4674  // parse wsdl file
4675  if ($this->wsdl != "") {
4676  $this->parseWSDL($this->wsdl);
4677  }
4678  // imports
4679  // TODO: handle imports more properly, grabbing them in-line and nesting them
4680  $imported_urls = array();
4681  $imported = 1;
4682  while ($imported > 0) {
4683  $imported = 0;
4684  // Schema imports
4685  foreach ($this->schemas as $ns => $list) {
4686  foreach ($list as $xs) {
4687  $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
4688  foreach ($xs->imports as $ns2 => $list2) {
4689  for ($ii = 0; $ii < count($list2); $ii++) {
4690  if (! $list2[$ii]['loaded']) {
4691  $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
4692  $url = $list2[$ii]['location'];
4693  if ($url != '') {
4694  $urlparts = parse_url($url);
4695  if (!isset($urlparts['host'])) {
4696  $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') .
4697  substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1) . $urlparts['path'];
4698  }
4699  if (! in_array($url, $imported_urls)) {
4700  $this->parseWSDL($url);
4701  $imported++;
4702  $imported_urls[] = $url;
4703  }
4704  } else {
4705  $this->debug("Unexpected scenario: empty URL for unloaded import");
4706  }
4707  }
4708  }
4709  }
4710  }
4711  }
4712  // WSDL imports
4713  $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
4714  foreach ($this->import as $ns => $list) {
4715  for ($ii = 0; $ii < count($list); $ii++) {
4716  if (! $list[$ii]['loaded']) {
4717  $this->import[$ns][$ii]['loaded'] = true;
4718  $url = $list[$ii]['location'];
4719  if ($url != '') {
4720  $urlparts = parse_url($url);
4721  if (!isset($urlparts['host'])) {
4722  $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') .
4723  substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1) . $urlparts['path'];
4724  }
4725  if (! in_array($url, $imported_urls)) {
4726  $this->parseWSDL($url);
4727  $imported++;
4728  $imported_urls[] = $url;
4729  }
4730  } else {
4731  $this->debug("Unexpected scenario: empty URL for unloaded import");
4732  }
4733  }
4734  }
4735  }
4736  }
4737  // add new data to operation data
4738  foreach ($this->bindings as $binding => $bindingData) {
4739  if (isset($bindingData['operations']) && is_array($bindingData['operations'])) {
4740  foreach ($bindingData['operations'] as $operation => $data) {
4741  $this->debug('post-parse data gathering for ' . $operation);
4742  $this->bindings[$binding]['operations'][$operation]['input'] =
4743  isset($this->bindings[$binding]['operations'][$operation]['input']) ?
4744  array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) :
4745  $this->portTypes[ $bindingData['portType'] ][$operation]['input'];
4746  $this->bindings[$binding]['operations'][$operation]['output'] =
4747  isset($this->bindings[$binding]['operations'][$operation]['output']) ?
4748  array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) :
4749  $this->portTypes[ $bindingData['portType'] ][$operation]['output'];
4750  if (isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])) {
4751  $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ];
4752  }
4753  if (isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])) {
4754  $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ];
4755  }
4756  // Set operation style if necessary, but do not override one already provided
4757  if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) {
4758  $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style'];
4759  }
4760  $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : '';
4761  $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : '';
4762  $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : '';
4763  }
4764  }
4765  }
4766  }
$wsdl
Definition: nusoap.php:4593
parses a WSDL file, allows access to it&#39;s data, other utility methods.
Definition: nusoap.php:4587
parseWSDL($wsdl='')
parses the wsdl document
Definition: nusoap.php:4774
$url
Definition: shib_logout.php:66
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBindingData()

wsdl::getBindingData (   $binding)

Definition at line 5152 of file nusoap.php.

5153  {
5154  if (is_array($this->bindings[$binding])) {
5155  return $this->bindings[$binding];
5156  }
5157  }

◆ getOperationData()

wsdl::getOperationData (   $operation,
  $bindingType = 'soap' 
)

returns an associative array of data necessary for calling an operation

Parameters
string$operationname of operation
string$bindingTypetype of binding eg: soap, soap12
Returns
array public

Definition at line 5198 of file nusoap.php.

Referenced by nusoap_server\invoke_method(), and nusoap_server\verify_method().

5199  {
5200  if ($bindingType == 'soap') {
5201  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
5202  } elseif ($bindingType == 'soap12') {
5203  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
5204  }
5205  // loop thru ports
5206  foreach ($this->ports as $port => $portData) {
5207  // binding type of port matches parameter
5208  if ($portData['bindingType'] == $bindingType) {
5209  // get binding
5210  //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
5211  foreach (array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) {
5212  // note that we could/should also check the namespace here
5213  if ($operation == $bOperation) {
5214  $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
5215  return $opData;
5216  }
5217  }
5218  }
5219  }
5220  }
$opData
Definition: nusoap.php:4608
+ Here is the caller graph for this function:

◆ getOperationDataForSoapAction()

wsdl::getOperationDataForSoapAction (   $soapAction,
  $bindingType = 'soap' 
)

returns an associative array of data necessary for calling an operation

Parameters
string$soapActionsoapAction for operation
string$bindingTypetype of binding eg: soap, soap12
Returns
array public

Definition at line 5230 of file nusoap.php.

Referenced by nusoap_server\invoke_method().

5231  {
5232  if ($bindingType == 'soap') {
5233  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
5234  } elseif ($bindingType == 'soap12') {
5235  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
5236  }
5237  // loop thru ports
5238  foreach ($this->ports as $port => $portData) {
5239  // binding type of port matches parameter
5240  if ($portData['bindingType'] == $bindingType) {
5241  // loop through operations for the binding
5242  foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
5243  if ($opData['soapAction'] == $soapAction) {
5244  return $opData;
5245  }
5246  }
5247  }
5248  }
5249  }
$opData
Definition: nusoap.php:4608
+ Here is the caller graph for this function:

◆ getOperations()

wsdl::getOperations (   $bindingType = 'soap')

returns an assoc array of operation names => operation data

Parameters
string$bindingTypeeg: soap, smtp, dime (only soap and soap12 are currently supported)
Returns
array public

Definition at line 5166 of file nusoap.php.

Referenced by nusoap_client\checkWSDL().

5167  {
5168  $ops = array();
5169  if ($bindingType == 'soap') {
5170  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
5171  } elseif ($bindingType == 'soap12') {
5172  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
5173  }
5174  // loop thru ports
5175  foreach ($this->ports as $port => $portData) {
5176  // binding type of port matches parameter
5177  if ($portData['bindingType'] == $bindingType) {
5178  //$this->debug("getOperations for port $port");
5179  //$this->debug("port data: " . $this->varDump($portData));
5180  //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ]));
5181  // merge bindings
5182  if (isset($this->bindings[ $portData['binding'] ]['operations'])) {
5183  $ops = array_merge($ops, $this->bindings[ $portData['binding'] ]['operations']);
5184  }
5185  }
5186  }
5187  return $ops;
5188  }
+ Here is the caller graph for this function:

◆ getTypeDef()

wsdl::getTypeDef (   $type,
  $ns 
)

returns an array of information about a given type returns false if no type exists by the given name

typeDef = array( 'elements' => array(), // refs to elements array 'restrictionBase' => '', 'phpType' => '', 'order' => '(sequence|all)', 'attrs' => array() // refs to attributes array )

Parameters
string$typethe type
string$nsnamespace (not prefix) of the type
Returns
mixed public
See also
nusoap_xmlschema

Definition at line 5269 of file nusoap.php.

References nusoap_base\debug(), and nusoap_base\varDump().

5270  {
5271  $this->debug("in getTypeDef: type=$type, ns=$ns");
5272  if ((! $ns) && isset($this->namespaces['tns'])) {
5273  $ns = $this->namespaces['tns'];
5274  $this->debug("in getTypeDef: type namespace forced to $ns");
5275  }
5276  if (!isset($this->schemas[$ns])) {
5277  foreach ($this->schemas as $ns0 => $schema0) {
5278  if (strcasecmp($ns, $ns0) == 0) {
5279  $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0");
5280  $ns = $ns0;
5281  break;
5282  }
5283  }
5284  }
5285  if (isset($this->schemas[$ns])) {
5286  $this->debug("in getTypeDef: have schema for namespace $ns");
5287  for ($i = 0; $i < count($this->schemas[$ns]); $i++) {
5288  $xs = &$this->schemas[$ns][$i];
5289  $t = $xs->getTypeDef($type);
5290  //$this->appendDebug($xs->getDebug());
5291  //$xs->clearDebug();
5292  if ($t) {
5293  if (!isset($t['phpType'])) {
5294  // get info for type to tack onto the element
5295  $uqType = substr($t['type'], strrpos($t['type'], ':') + 1);
5296  $ns = substr($t['type'], 0, strrpos($t['type'], ':'));
5297  $etype = $this->getTypeDef($uqType, $ns);
5298  if ($etype) {
5299  $this->debug("found type for [element] $type:");
5300  $this->debug($this->varDump($etype));
5301  if (isset($etype['phpType'])) {
5302  $t['phpType'] = $etype['phpType'];
5303  }
5304  if (isset($etype['elements'])) {
5305  $t['elements'] = $etype['elements'];
5306  }
5307  if (isset($etype['attrs'])) {
5308  $t['attrs'] = $etype['attrs'];
5309  }
5310  }
5311  }
5312  return $t;
5313  }
5314  }
5315  } else {
5316  $this->debug("in getTypeDef: do not have schema for namespace $ns");
5317  }
5318  return false;
5319  }
getTypeDef($type, $ns)
returns an array of information about a given type returns false if no type exists by the given name ...
Definition: nusoap.php:5269
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:867
+ Here is the call graph for this function:

◆ parametersMatchWrapped()

wsdl::parametersMatchWrapped (   $type,
$parameters 
)

determine whether a set of parameters are unwrapped when they are expect to be wrapped, Microsoft-style.

Parameters
string$typethe type (element name) of the wrapper
array$parametersthe parameter values for the SOAP call
Returns
boolean whether they parameters are unwrapped (and should be wrapped) private

Definition at line 5616 of file nusoap.php.

References nusoap_base\appendDebug(), nusoap_base\debug(), nusoap_base\getNamespaceFromPrefix(), nusoap_base\isArraySimpleOrStruct(), and nusoap_base\varDump().

5617  {
5618  $this->debug("in parametersMatchWrapped type=$type, parameters=");
5619  $this->appendDebug($this->varDump($parameters));
5620 
5621  // split type into namespace:unqualified-type
5622  if (strpos($type, ':')) {
5623  $uqType = substr($type, strrpos($type, ':') + 1);
5624  $ns = substr($type, 0, strrpos($type, ':'));
5625  $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns");
5626  if ($this->getNamespaceFromPrefix($ns)) {
5627  $ns = $this->getNamespaceFromPrefix($ns);
5628  $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns");
5629  }
5630  } else {
5631  // TODO: should the type be compared to types in XSD, and the namespace
5632  // set to XSD if the type matches?
5633  $this->debug("in parametersMatchWrapped: No namespace for type $type");
5634  $ns = '';
5635  $uqType = $type;
5636  }
5637 
5638  // get the type information
5639  if (!$typeDef = $this->getTypeDef($uqType, $ns)) {
5640  $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type.");
5641  return false;
5642  }
5643  $this->debug("in parametersMatchWrapped: found typeDef=");
5644  $this->appendDebug($this->varDump($typeDef));
5645  if (substr($uqType, -1) == '^') {
5646  $uqType = substr($uqType, 0, -1);
5647  }
5648  $phpType = $typeDef['phpType'];
5649  $arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '');
5650  $this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType");
5651 
5652  // we expect a complexType or element of complexType
5653  if ($phpType != 'struct') {
5654  $this->debug("in parametersMatchWrapped: not a struct");
5655  return false;
5656  }
5657 
5658  // see whether the parameter names match the elements
5659  if (isset($typeDef['elements']) && is_array($typeDef['elements'])) {
5660  $elements = 0;
5661  $matches = 0;
5662  $change = false;
5663  if ($this->isArraySimpleOrStruct($parameters) == 'arraySimple' && count($parameters) == count($typeDef['elements'])) {
5664  $this->debug("in parametersMatchWrapped: (wrapped return value kludge) correct number of elements in simple array, so change array and wrap");
5665  $change = true;
5666  }
5667  foreach ($typeDef['elements'] as $name => $attrs) {
5668  if ($change) {
5669  $this->debug("in parametersMatchWrapped: change parameter $element to name $name");
5670  $parameters[$name] = $parameters[$elements];
5671  unset($parameters[$elements]);
5672  $matches++;
5673  } elseif (isset($parameters[$name])) {
5674  $this->debug("in parametersMatchWrapped: have parameter named $name");
5675  $matches++;
5676  } else {
5677  $this->debug("in parametersMatchWrapped: do not have parameter named $name");
5678  }
5679  $elements++;
5680  }
5681 
5682  $this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped parameter names");
5683  if ($matches == 0) {
5684  return false;
5685  }
5686  return true;
5687  }
5688 
5689  // since there are no elements for the type, if the user passed no
5690  // parameters, the parameters match wrapped.
5691  $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType");
5692  return count($parameters) == 0;
5693  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:263
getTypeDef($type, $ns)
returns an array of information about a given type returns false if no type exists by the given name ...
Definition: nusoap.php:5269
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:365
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:867
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:813
+ Here is the call graph for this function:

◆ parseWSDL()

wsdl::parseWSDL (   $wsdl = '')

parses the wsdl document

Parameters
string$wsdlpath or URL private

Definition at line 4774 of file nusoap.php.

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

4775  {
4776  $this->debug("parse WSDL at path=$wsdl");
4777 
4778  if ($wsdl == '') {
4779  $this->debug('no wsdl passed to parseWSDL()!!');
4780  $this->setError('no wsdl passed to parseWSDL()!!');
4781  return false;
4782  }
4783 
4784  // parse $wsdl for url format
4785  $wsdl_props = parse_url($wsdl);
4786 
4787  if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) {
4788  $this->debug('getting WSDL http(s) URL ' . $wsdl);
4789  // get wsdl
4790  $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl);
4791  $tr->request_method = 'GET';
4792  $tr->useSOAPAction = false;
4793  if ($this->proxyhost && $this->proxyport) {
4794  $tr->setProxy($this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword);
4795  }
4796  if ($this->authtype != '') {
4797  $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
4798  }
4799  $tr->setEncoding('gzip, deflate');
4800  $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout);
4801  //$this->debug("WSDL request\n" . $tr->outgoing_payload);
4802  //$this->debug("WSDL response\n" . $tr->incoming_payload);
4803  $this->appendDebug($tr->getDebug());
4804  // catch errors
4805  if ($err = $tr->getError()) {
4806  $errstr = 'HTTP ERROR: ' . $err;
4807  $this->debug($errstr);
4808  $this->setError($errstr);
4809  unset($tr);
4810  return false;
4811  }
4812  unset($tr);
4813  $this->debug("got WSDL URL");
4814  } else {
4815  // $wsdl is not http(s), so treat it as a file URL or plain file path
4816  if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) {
4817  $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path'];
4818  } else {
4819  $path = $wsdl;
4820  }
4821  $this->debug('getting WSDL file ' . $path);
4822  if ($fp = @fopen($path, 'r')) {
4823  $wsdl_string = '';
4824  while ($data = fread($fp, 32768)) {
4825  $wsdl_string .= $data;
4826  }
4827  fclose($fp);
4828  } else {
4829  $errstr = "Bad path to WSDL file $path";
4830  $this->debug($errstr);
4831  $this->setError($errstr);
4832  return false;
4833  }
4834  }
4835  $this->debug('Parse WSDL');
4836  // end new code added
4837  // Create an XML parser.
4838  $this->parser = xml_parser_create();
4839  // Set the options for parsing the XML data.
4840  // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
4841  xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
4842  // Set the object for the parser.
4843  // Set the element handlers for the parser.
4844  xml_set_element_handler($this->parser, $this->start_element(...), $this->end_element(...));
4845  xml_set_character_data_handler($this->parser, $this->character_data(...));
4846  // Parse the XML file.
4847  if (!xml_parse($this->parser, $wsdl_string, true)) {
4848  // Display an error message.
4849  $errstr = sprintf(
4850  'XML error parsing WSDL from %s on line %d: %s',
4851  $wsdl,
4852  xml_get_current_line_number($this->parser),
4853  xml_error_string(xml_get_error_code($this->parser))
4854  );
4855  $this->debug($errstr);
4856  $this->debug("XML payload:\n" . $wsdl_string);
4857  $this->setError($errstr);
4858  return false;
4859  }
4860  // free the parser
4861  xml_parser_free($this->parser);
4862  $this->debug('Parsing WSDL done');
4863  // catch wsdl parse errors
4864  if ($this->getError()) {
4865  return false;
4866  }
4867  return true;
4868  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:263
setError($str)
sets error string
Definition: nusoap.php:353
$wsdl
Definition: nusoap.php:4593
transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CUR...
Definition: nusoap.php:2140
character_data($parser, $data)
element content handler
Definition: nusoap.php:5122
end_element($parser, $name)
end-element handler
Definition: nusoap.php:5091
$path
Definition: ltiservices.php:29
getError()
returns error string if present
Definition: nusoap.php:339
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
start_element($parser, $name, $attrs)
start-element handler
Definition: nusoap.php:4878
+ Here is the call graph for this function:

◆ serialize()

wsdl::serialize (   $debug = 0)

serialize the parsed wsdl

Parameters
mixed$debugwhether to put debug=1 in endpoint URL
Returns
string serialization of WSDL public

Definition at line 5468 of file nusoap.php.

References $_GET, $location, nusoap_base\getLocalPart(), nusoap_base\getNamespaceFromPrefix(), nusoap_base\getPrefix(), and nusoap_base\getPrefixFromNamespace().

Referenced by nusoap_server\service().

5469  {
5470  $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>';
5471  $xml .= "\n<definitions";
5472  foreach ($this->namespaces as $k => $v) {
5473  $xml .= " xmlns:$k=\"$v\"";
5474  }
5475  // 10.9.02 - add poulter fix for wsdl and tns declarations
5476  if (isset($this->namespaces['wsdl'])) {
5477  $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
5478  }
5479  if (isset($this->namespaces['tns'])) {
5480  $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
5481  }
5482  $xml .= '>';
5483  // imports
5484  if (sizeof($this->import) > 0) {
5485  foreach ($this->import as $ns => $list) {
5486  foreach ($list as $ii) {
5487  if ($ii['location'] != '') {
5488  $xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />';
5489  } else {
5490  $xml .= '<import namespace="' . $ns . '" />';
5491  }
5492  }
5493  }
5494  }
5495  // types
5496  if (count($this->schemas) >= 1) {
5497  $xml .= "\n<types>\n";
5498  foreach ($this->schemas as $ns => $list) {
5499  foreach ($list as $xs) {
5500  $xml .= $xs->serializeSchema();
5501  }
5502  }
5503  $xml .= '</types>';
5504  }
5505  // messages
5506  if (count($this->messages) >= 1) {
5507  foreach ($this->messages as $msgName => $msgParts) {
5508  $xml .= "\n<message name=\"" . $msgName . '">';
5509  if (is_array($msgParts)) {
5510  foreach ($msgParts as $partName => $partType) {
5511  // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>';
5512  if (strpos($partType, ':')) {
5513  $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType));
5514  } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) {
5515  // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>';
5516  $typePrefix = 'xsd';
5517  } else {
5518  foreach ($this->typemap as $ns => $types) {
5519  if (isset($types[$partType])) {
5520  $typePrefix = $this->getPrefixFromNamespace($ns);
5521  }
5522  }
5523  if (!isset($typePrefix)) {
5524  die("$partType has no namespace!");
5525  }
5526  }
5527  $ns = $this->getNamespaceFromPrefix($typePrefix);
5528  $localPart = $this->getLocalPart($partType);
5529  $typeDef = $this->getTypeDef($localPart, $ns);
5530  if (($typeDef['typeClass'] ?? '') == 'element') {
5531  $elementortype = 'element';
5532  if (substr($localPart, -1) == '^') {
5533  $localPart = substr($localPart, 0, -1);
5534  }
5535  } else {
5536  $elementortype = 'type';
5537  }
5538  $xml .= "\n" . ' <part name="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $localPart . '" />';
5539  }
5540  }
5541  $xml .= '</message>';
5542  }
5543  }
5544  // bindings & porttypes
5545  if (count($this->bindings) >= 1) {
5546  $binding_xml = '';
5547  $portType_xml = '';
5548  foreach ($this->bindings as $bindingName => $attrs) {
5549  $binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">';
5550  $binding_xml .= "\n" . ' <soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>';
5551  $portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">';
5552  foreach ($attrs['operations'] as $opName => $opParts) {
5553  $binding_xml .= "\n" . ' <operation name="' . $opName . '">';
5554  $binding_xml .= "\n" . ' <soap:operation soapAction="' . $opParts['soapAction'] . '" style="' . $opParts['style'] . '"/>';
5555  if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') {
5556  $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"';
5557  } else {
5558  $enc_style = '';
5559  }
5560  $binding_xml .= "\n" . ' <input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>';
5561  if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') {
5562  $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"';
5563  } else {
5564  $enc_style = '';
5565  }
5566  $binding_xml .= "\n" . ' <output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>';
5567  $binding_xml .= "\n" . ' </operation>';
5568  $portType_xml .= "\n" . ' <operation name="' . $opParts['name'] . '"';
5569  if (isset($opParts['parameterOrder'])) {
5570  $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"';
5571  }
5572  $portType_xml .= '>';
5573  if (isset($opParts['documentation']) && $opParts['documentation'] != '') {
5574  $portType_xml .= "\n" . ' <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>';
5575  }
5576  $portType_xml .= "\n" . ' <input message="tns:' . $opParts['input']['message'] . '"/>';
5577  $portType_xml .= "\n" . ' <output message="tns:' . $opParts['output']['message'] . '"/>';
5578  $portType_xml .= "\n" . ' </operation>';
5579  }
5580  $portType_xml .= "\n" . '</portType>';
5581  $binding_xml .= "\n" . '</binding>';
5582  }
5583  $xml .= $portType_xml . $binding_xml;
5584  }
5585  // services
5586  $xml .= "\n<service name=\"" . $this->serviceName . '">';
5587  $has_client = isset($_GET['client_id']);
5588  if (count($this->ports) >= 1) {
5589  foreach ($this->ports as $pName => $attrs) {
5590  $xml .= "\n" . ' <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">';
5591  $locations = $attrs['location'];
5592  $locations = is_array($locations) ? $locations : [$locations];
5593  foreach ($locations as $location) {
5594  $address = $location . ($debug || $has_client ? "?" : "")
5595  . ($debug ? 'debug=1' : '') . ($debug && $has_client ? "&amp;" : "")
5596  . ($has_client ? 'client_id=' . $_GET['client_id'] : '');
5597  $xml .= "\n" . ' <soap:address location="' . $address . '"/>';
5598  }
5599  $xml .= "\n" . ' </port>';
5600  }
5601  }
5602 
5603  $xml .= "\n" . '</service>';
5604  return $xml . "\n</definitions>";
5605  }
getTypeDef($type, $ns)
returns an array of information about a given type returns false if no type exists by the given name ...
Definition: nusoap.php:5269
$_GET["client_id"]
Definition: webdav.php:30
$location
Definition: buildRTE.php:22
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:779
getPrefixFromNamespace($ns)
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given...
Definition: nusoap.php:830
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:797
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:813
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serializeComplexTypeAttributes()

wsdl::serializeComplexTypeAttributes (   $typeDef,
  $value,
  $ns,
  $uqType 
)

serializes the attributes for a complexType

Parameters
array$typeDefour internal representation of an XML schema type (or element)
mixed$valuea native PHP value (parameter value)
string$nsthe namespace of the type
string$uqTypethe local part of the type
Returns
string value serialized as an XML string private

Definition at line 6187 of file nusoap.php.

References nusoap_base\debug(), nusoap_base\expandEntities(), nusoap_base\getLocalPart(), nusoap_base\getNamespaceFromPrefix(), and nusoap_base\getPrefix().

6188  {
6189  $xml = '';
6190  if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) {
6191  $this->debug("serialize attributes for XML Schema type $ns:$uqType");
6192  if (is_array($value)) {
6193  $xvalue = $value;
6194  } elseif (is_object($value)) {
6195  $xvalue = get_object_vars($value);
6196  } else {
6197  $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
6198  $xvalue = array();
6199  }
6200  foreach ($typeDef['attrs'] as $aName => $attrs) {
6201  if (isset($xvalue['!' . $aName])) {
6202  $xname = '!' . $aName;
6203  $this->debug("value provided for attribute $aName with key $xname");
6204  } elseif (isset($xvalue[$aName])) {
6205  $xname = $aName;
6206  $this->debug("value provided for attribute $aName with key $xname");
6207  } elseif (isset($attrs['default'])) {
6208  $xname = '!' . $aName;
6209  $xvalue[$xname] = $attrs['default'];
6210  $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName);
6211  } else {
6212  $xname = '';
6213  $this->debug("no value provided for attribute $aName");
6214  }
6215  if ($xname) {
6216  $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
6217  }
6218  }
6219  } else {
6220  $this->debug("no attributes to serialize for XML Schema type $ns:$uqType");
6221  }
6222  if (isset($typeDef['extensionBase'])) {
6223  $ns = $this->getPrefix($typeDef['extensionBase']);
6224  $uqType = $this->getLocalPart($typeDef['extensionBase']);
6225  if ($this->getNamespaceFromPrefix($ns)) {
6226  $ns = $this->getNamespaceFromPrefix($ns);
6227  }
6228  if ($typeDef = $this->getTypeDef($uqType, $ns)) {
6229  $this->debug("serialize attributes for extension base $ns:$uqType");
6230  $xml .= $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
6231  } else {
6232  $this->debug("extension base $ns:$uqType is not a supported type");
6233  }
6234  }
6235  return $xml;
6236  }
getTypeDef($type, $ns)
returns an array of information about a given type returns false if no type exists by the given name ...
Definition: nusoap.php:5269
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:779
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:797
expandEntities($val)
expands entities, e.g.
Definition: nusoap.php:321
serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType)
serializes the attributes for a complexType
Definition: nusoap.php:6187
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:813
+ Here is the call graph for this function:

◆ serializeComplexTypeElements()

wsdl::serializeComplexTypeElements (   $typeDef,
  $value,
  $ns,
  $uqType,
  $use = 'encoded',
  $encodingStyle = false 
)

serializes the elements for a complexType

Parameters
array$typeDefour internal representation of an XML schema type (or element)
mixed$valuea native PHP value (parameter value)
string$nsthe namespace of the type
string$uqTypethe local part of the type
string$useuse for part (encoded|literal)
string$encodingStyleSOAP encoding style for the value (if different than the enclosing style)
Returns
string value serialized as an XML string private

Definition at line 6250 of file nusoap.php.

References nusoap_base\debug(), nusoap_base\getLocalPart(), nusoap_base\getNamespaceFromPrefix(), nusoap_base\getPrefix(), nusoap_base\isArraySimpleOrStruct(), null, and nusoap_base\serialize_val().

6251  {
6252  $xml = '';
6253  if (isset($typeDef['elements']) && is_array($typeDef['elements'])) {
6254  $this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType");
6255  if (is_array($value)) {
6256  $xvalue = $value;
6257  } elseif (is_object($value)) {
6258  $xvalue = get_object_vars($value);
6259  } else {
6260  $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
6261  $xvalue = array();
6262  }
6263  // toggle whether all elements are present - ideally should validate against schema
6264  if (count($typeDef['elements']) != count($xvalue)) {
6265  $optionals = true;
6266  }
6267  foreach ($typeDef['elements'] as $eName => $attrs) {
6268  if (!isset($xvalue[$eName])) {
6269  if (isset($attrs['default'])) {
6270  $xvalue[$eName] = $attrs['default'];
6271  $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName);
6272  }
6273  }
6274  // if user took advantage of a minOccurs=0, then only serialize named parameters
6275  if (isset($optionals)
6276  && (!isset($xvalue[$eName]))
6277  && ((!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
6278  ) {
6279  if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') {
6280  $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']);
6281  }
6282  // do nothing
6283  $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing");
6284  } else {
6285  // get value
6286  if (isset($xvalue[$eName])) {
6287  $v = $xvalue[$eName];
6288  } else {
6289  $v = null;
6290  }
6291  if (isset($attrs['form'])) {
6292  $unqualified = ($attrs['form'] == 'unqualified');
6293  } else {
6294  $unqualified = false;
6295  }
6296  if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') {
6297  $vv = $v;
6298  foreach ($vv as $k => $v) {
6299  if (isset($attrs['type']) || isset($attrs['ref'])) {
6300  // serialize schema-defined type
6301  $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
6302  } else {
6303  // serialize generic type (can this ever really happen?)
6304  $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
6305  $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
6306  }
6307  }
6308  } else {
6309  if (isset($attrs['type']) || isset($attrs['ref'])) {
6310  // serialize schema-defined type
6311  $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
6312  } else {
6313  // serialize generic type (can this ever really happen?)
6314  $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
6315  $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
6316  }
6317  }
6318  }
6319  }
6320  } else {
6321  $this->debug("no elements to serialize for XML Schema type $ns:$uqType");
6322  }
6323  if (isset($typeDef['extensionBase'])) {
6324  $ns = $this->getPrefix($typeDef['extensionBase']);
6325  $uqType = $this->getLocalPart($typeDef['extensionBase']);
6326  if ($this->getNamespaceFromPrefix($ns)) {
6327  $ns = $this->getNamespaceFromPrefix($ns);
6328  }
6329  if ($typeDef = $this->getTypeDef($uqType, $ns)) {
6330  $this->debug("serialize elements for extension base $ns:$uqType");
6331  $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
6332  } else {
6333  $this->debug("extension base $ns:$uqType is not a supported type");
6334  }
6335  }
6336  return $xml;
6337  }
getTypeDef($type, $ns)
returns an array of information about a given type returns false if no type exists by the given name ...
Definition: nusoap.php:5269
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:365
serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false)
serializes the elements for a complexType
Definition: nusoap.php:6250
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:779
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
serializes a PHP value according a given type definition
Definition: nusoap.php:5883
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:797
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:813
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
+ Here is the call graph for this function:

◆ serializeParameters()

wsdl::serializeParameters (   $operation,
  $direction,
  $parameters 
)

serialize a PHP value according to a WSDL message definition

TODO

  • multi-ref serialization
  • validate PHP values against type definitions, return errors if invalid
Parameters
string$operationoperation name
string$direction(input|output)
mixed$parametersparameter value(s)
Returns
mixed parameters serialized as XML or false on error (e.g. operation not found) public
Deprecated:

Definition at line 5805 of file nusoap.php.

References nusoap_base\appendDebug(), nusoap_base\debug(), nusoap_base\isArraySimpleOrStruct(), null, nusoap_base\setError(), and nusoap_base\varDump().

5806  {
5807  $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion");
5808  $this->appendDebug('parameters=' . $this->varDump($parameters));
5809 
5810  if ($direction != 'input' && $direction != 'output') {
5811  $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
5812  $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
5813  return false;
5814  }
5815  if (!$opData = $this->getOperationData($operation)) {
5816  $this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
5817  $this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
5818  return false;
5819  }
5820  $this->debug('opData:');
5821  $this->appendDebug($this->varDump($opData));
5822 
5823  // Get encoding style for output and set to current
5824  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
5825  if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
5826  $encodingStyle = $opData['output']['encodingStyle'];
5827  $enc_style = $encodingStyle;
5828  }
5829 
5830  // set input params
5831  $xml = '';
5832  if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
5833  $use = $opData[$direction]['use'];
5834  $this->debug("use=$use");
5835  $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
5836  if (is_array($parameters)) {
5837  $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
5838  $this->debug('have ' . $parametersArrayType . ' parameters');
5839  foreach ($opData[$direction]['parts'] as $name => $type) {
5840  $this->debug('serializing part "' . $name . '" of type "' . $type . '"');
5841  // Track encoding style
5842  if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
5843  $encodingStyle = $opData[$direction]['encodingStyle'];
5844  $enc_style = $encodingStyle;
5845  } else {
5846  $enc_style = false;
5847  }
5848  // NOTE: add error handling here
5849  // if serializeType returns false, then catch global error and fault
5850  if ($parametersArrayType == 'arraySimple') {
5851  $p = array_shift($parameters);
5852  $this->debug('calling serializeType w/indexed param');
5853  $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
5854  } elseif (isset($parameters[$name])) {
5855  $this->debug('calling serializeType w/named param');
5856  $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
5857  } else {
5858  // TODO: only send nillable
5859  $this->debug('calling serializeType w/null param');
5860  $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
5861  }
5862  }
5863  } else {
5864  $this->debug('no parameters passed.');
5865  }
5866  }
5867  $this->debug("serializeParameters returning: $xml");
5868  return $xml;
5869  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:263
setError($str)
sets error string
Definition: nusoap.php:353
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:365
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
serializes a PHP value according a given type definition
Definition: nusoap.php:5883
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:867
getOperationData($operation, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:5198
$opData
Definition: nusoap.php:4608
+ Here is the call graph for this function:

◆ serializeRPCParameters()

wsdl::serializeRPCParameters (   $operation,
  $direction,
  $parameters,
  $bindingType = 'soap' 
)

serialize PHP values according to a WSDL message definition contrary to the method name, this is not limited to RPC

TODO

  • multi-ref serialization
  • validate PHP values against type definitions, return errors if invalid
Parameters
string$operationoperation name
string$direction(input|output)
mixed$parametersparameter value(s)
string$bindingType(soap|soap12)
Returns
mixed parameters serialized as XML or false on error (e.g. operation not found) public

Definition at line 5710 of file nusoap.php.

References $parts, nusoap_base\appendDebug(), nusoap_base\debug(), nusoap_base\isArraySimpleOrStruct(), null, nusoap_base\setError(), and nusoap_base\varDump().

Referenced by nusoap_client\call(), and nusoap_server\serialize_return().

5711  {
5712  $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType");
5713  $this->appendDebug('parameters=' . $this->varDump($parameters));
5714 
5715  if ($direction != 'input' && $direction != 'output') {
5716  $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
5717  $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
5718  return false;
5719  }
5720  if (!$opData = $this->getOperationData($operation, $bindingType)) {
5721  $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
5722  $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
5723  return false;
5724  }
5725  $this->debug('in serializeRPCParameters: opData:');
5726  $this->appendDebug($this->varDump($opData));
5727 
5728  // Get encoding style for output and set to current
5729  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
5730  if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
5731  $encodingStyle = $opData['output']['encodingStyle'];
5732  $enc_style = $encodingStyle;
5733  }
5734 
5735  // set input params
5736  $xml = '';
5737  if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
5738  $parts = &$opData[$direction]['parts'];
5739  $part_count = sizeof($parts);
5740  $style = $opData['style'];
5741  $use = $opData[$direction]['use'];
5742  $this->debug("have $part_count part(s) to serialize using $style/$use");
5743  if (is_array($parameters)) {
5744  $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
5745  $parameter_count = count($parameters);
5746  $this->debug("have $parameter_count parameter(s) provided as $parametersArrayType to serialize");
5747  // check for Microsoft-style wrapped parameters
5748  if ($style == 'document' && $use == 'literal' && $part_count == 1 && isset($parts['parameters'])) {
5749  $this->debug('check whether the caller has wrapped the parameters');
5750  if ((($parametersArrayType == 'arrayStruct' || $parameter_count == 0) && !isset($parameters['parameters'])) || ($direction == 'output' && $parametersArrayType == 'arraySimple' && $parameter_count == 1)) {
5751  $this->debug('check whether caller\'s parameters match the wrapped ones');
5752  if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) {
5753  $this->debug('wrap the parameters for the caller');
5754  $parameters = array('parameters' => $parameters);
5755  $parameter_count = 1;
5756  }
5757  }
5758  }
5759  foreach ($parts as $name => $type) {
5760  $this->debug("serializing part $name of type $type");
5761  // Track encoding style
5762  if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
5763  $encodingStyle = $opData[$direction]['encodingStyle'];
5764  $enc_style = $encodingStyle;
5765  } else {
5766  $enc_style = false;
5767  }
5768  // NOTE: add error handling here
5769  // if serializeType returns false, then catch global error and fault
5770  if ($parametersArrayType == 'arraySimple') {
5771  $p = array_shift($parameters);
5772  $this->debug('calling serializeType w/indexed param');
5773  $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
5774  } elseif (isset($parameters[$name])) {
5775  $this->debug('calling serializeType w/named param');
5776  $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
5777  } else {
5778  // TODO: only send nillable
5779  $this->debug('calling serializeType w/null param');
5780  $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
5781  }
5782  }
5783  } else {
5784  $this->debug('no parameters passed.');
5785  }
5786  }
5787  $this->debug("serializeRPCParameters returning: $xml");
5788  return $xml;
5789  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:263
setError($str)
sets error string
Definition: nusoap.php:353
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:365
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
serializes a PHP value according a given type definition
Definition: nusoap.php:5883
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:867
getOperationData($operation, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:5198
$opData
Definition: nusoap.php:4608
parametersMatchWrapped($type, &$parameters)
determine whether a set of parameters are unwrapped when they are expect to be wrapped, Microsoft-style.
Definition: nusoap.php:5616
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serializeType()

wsdl::serializeType (   $name,
  $type,
  $value,
  $use = 'encoded',
  $encodingStyle = false,
  $unqualified = false 
)

serializes a PHP value according a given type definition

Parameters
string$namename of value (part or element)
string$typeXML schema type of value (type or element)
mixed$valuea native PHP value (parameter value)
string$useuse for part (encoded|literal)
string$encodingStyleSOAP encoding style for the value (if different than the enclosing style)
boolean$unqualifieda kludge for what should be XML namespace form handling
Returns
string value serialized as an XML string private

Definition at line 5883 of file nusoap.php.

References nusoap_base\appendDebug(), nusoap_base\debug(), nusoap_base\expandEntities(), nusoap_base\getLocalPart(), nusoap_base\getNamespaceFromPrefix(), nusoap_base\getPrefix(), nusoap_base\getPrefixFromNamespace(), null, nusoap_base\serialize_val(), nusoap_base\setError(), and nusoap_base\varDump().

5884  {
5885  $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified"));
5886  $this->appendDebug("value=" . $this->varDump($value));
5887  if ($use == 'encoded' && $encodingStyle) {
5888  $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"';
5889  }
5890 
5891  // if a soapval has been supplied, let its type override the WSDL
5892  if (is_object($value) && get_class($value) == 'soapval') {
5893  if ($value->type_ns) {
5894  $type = $value->type_ns . ':' . $value->type;
5895  $forceType = true;
5896  $this->debug("in serializeType: soapval overrides type to $type");
5897  } elseif ($value->type) {
5898  $type = $value->type;
5899  $forceType = true;
5900  $this->debug("in serializeType: soapval overrides type to $type");
5901  } else {
5902  $forceType = false;
5903  $this->debug("in serializeType: soapval does not override type");
5904  }
5905  $attrs = $value->attributes;
5906  $value = $value->value;
5907  $this->debug("in serializeType: soapval overrides value to $value");
5908  if ($attrs) {
5909  if (!is_array($value)) {
5910  $value['!'] = $value;
5911  }
5912  foreach ($attrs as $n => $v) {
5913  $value['!' . $n] = $v;
5914  }
5915  $this->debug("in serializeType: soapval provides attributes");
5916  }
5917  } else {
5918  $forceType = false;
5919  }
5920 
5921  $xml = '';
5922  if (strpos($type, ':')) {
5923  $uqType = substr($type, strrpos($type, ':') + 1);
5924  $ns = substr($type, 0, strrpos($type, ':'));
5925  $this->debug("in serializeType: got a prefixed type: $uqType, $ns");
5926  if ($this->getNamespaceFromPrefix($ns)) {
5927  $ns = $this->getNamespaceFromPrefix($ns);
5928  $this->debug("in serializeType: expanded prefixed type: $uqType, $ns");
5929  }
5930 
5931  if ($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/') {
5932  $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type');
5933  if ($unqualified && $use == 'literal') {
5934  $elementNS = " xmlns=\"\"";
5935  } else {
5936  $elementNS = '';
5937  }
5938  if (is_null($value)) {
5939  if ($use == 'literal') {
5940  // TODO: depends on minOccurs
5941  $xml = "<$name$elementNS/>";
5942  } else {
5943  // TODO: depends on nillable, which should be checked before calling this method
5944  $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
5945  }
5946  $this->debug("in serializeType: returning: $xml");
5947  return $xml;
5948  }
5949  if ($uqType == 'Array') {
5950  // JBoss/Axis does this sometimes
5951  return $this->serialize_val($value, $name, false, false, false, false, $use);
5952  }
5953  if ($uqType == 'boolean') {
5954  if ((is_string($value) && $value == 'false') || (! $value)) {
5955  $value = 'false';
5956  } else {
5957  $value = 'true';
5958  }
5959  }
5960  if ($uqType == 'string' && gettype($value) == 'string') {
5961  $value = $this->expandEntities($value);
5962  }
5963  if (($uqType == 'long' || $uqType == 'unsignedLong') && gettype($value) == 'double') {
5964  $value = sprintf("%.0lf", $value);
5965  }
5966  // it's a scalar
5967  // TODO: what about null/nil values?
5968  // check type isn't a custom type extending xmlschema namespace
5969  if (!$this->getTypeDef($uqType, $ns)) {
5970  if ($use == 'literal') {
5971  if ($forceType) {
5972  $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
5973  } else {
5974  $xml = "<$name$elementNS>$value</$name>";
5975  }
5976  } else {
5977  $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
5978  }
5979  $this->debug("in serializeType: returning: $xml");
5980  return $xml;
5981  }
5982  $this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)');
5983  } elseif ($ns == 'http://xml.apache.org/xml-soap') {
5984  $this->debug('in serializeType: appears to be Apache SOAP type');
5985  if ($uqType == 'Map') {
5986  $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
5987  if (! $tt_prefix) {
5988  $this->debug('in serializeType: Add namespace for Apache SOAP type');
5989  $tt_prefix = 'ns' . rand(1000, 9999);
5990  $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap';
5991  // force this to be added to usedNamespaces
5992  $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
5993  }
5994  $contents = '';
5995  foreach ($value as $k => $v) {
5996  $this->debug("serializing map element: key $k, value $v");
5997  $contents .= '<item>';
5998  $contents .= $this->serialize_val($k, 'key', false, false, false, false, $use);
5999  $contents .= $this->serialize_val($v, 'value', false, false, false, false, $use);
6000  $contents .= '</item>';
6001  }
6002  if ($use == 'literal') {
6003  if ($forceType) {
6004  $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents</$name>";
6005  } else {
6006  $xml = "<$name>$contents</$name>";
6007  }
6008  } else {
6009  $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents</$name>";
6010  }
6011  $this->debug("in serializeType: returning: $xml");
6012  return $xml;
6013  }
6014  $this->debug('in serializeType: Apache SOAP type, but only support Map');
6015  }
6016  } else {
6017  // TODO: should the type be compared to types in XSD, and the namespace
6018  // set to XSD if the type matches?
6019  $this->debug("in serializeType: No namespace for type $type");
6020  $ns = '';
6021  $uqType = $type;
6022  }
6023  if (!$typeDef = $this->getTypeDef($uqType, $ns)) {
6024  $this->setError("$type ($uqType) is not a supported type.");
6025  $this->debug("in serializeType: $type ($uqType) is not a supported type.");
6026  return false;
6027  } else {
6028  $this->debug("in serializeType: found typeDef");
6029  $this->appendDebug('typeDef=' . $this->varDump($typeDef));
6030  if (substr($uqType, -1) == '^') {
6031  $uqType = substr($uqType, 0, -1);
6032  }
6033  }
6034  $phpType = $typeDef['phpType'];
6035  $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : ''));
6036  // if php type == struct, map value to the <all> element names
6037  if ($phpType == 'struct') {
6038  if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') {
6039  $elementName = $uqType;
6040  if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
6041  $elementNS = " xmlns=\"$ns\"";
6042  } else {
6043  $elementNS = " xmlns=\"\"";
6044  }
6045  } else {
6046  $elementName = $name;
6047  if ($unqualified) {
6048  $elementNS = " xmlns=\"\"";
6049  } else {
6050  $elementNS = '';
6051  }
6052  }
6053  if (is_null($value)) {
6054  if ($use == 'literal') {
6055  // TODO: depends on minOccurs
6056  $xml = "<$elementName$elementNS/>";
6057  } else {
6058  $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
6059  }
6060  $this->debug("in serializeType: returning: $xml");
6061  return $xml;
6062  }
6063  if (is_object($value)) {
6064  $value = get_object_vars($value);
6065  }
6066  if (is_array($value)) {
6067  $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
6068  if ($use == 'literal') {
6069  if ($forceType) {
6070  $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">";
6071  } else {
6072  $xml = "<$elementName$elementNS$elementAttrs>";
6073  }
6074  } else {
6075  $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>";
6076  }
6077 
6078  $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
6079  $xml .= "</$elementName>";
6080  } else {
6081  $this->debug("in serializeType: phpType is struct, but value is not an array");
6082  $this->setError("phpType is struct, but value is not an array: see debug output for details");
6083  $xml = '';
6084  }
6085  } elseif ($phpType == 'array') {
6086  if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
6087  $elementNS = " xmlns=\"$ns\"";
6088  } else {
6089  if ($unqualified) {
6090  $elementNS = " xmlns=\"\"";
6091  } else {
6092  $elementNS = '';
6093  }
6094  }
6095  if (is_null($value)) {
6096  if ($use == 'literal') {
6097  // TODO: depends on minOccurs
6098  $xml = "<$name$elementNS/>";
6099  } else {
6100  $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" .
6101  $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
6102  ":Array\" " .
6103  $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
6104  ':arrayType="' .
6105  $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) .
6106  ':' .
6107  $this->getLocalPart($typeDef['arrayType']) . "[0]\"/>";
6108  }
6109  $this->debug("in serializeType: returning: $xml");
6110  return $xml;
6111  }
6112  if (isset($typeDef['multidimensional'])) {
6113  $nv = array();
6114  foreach ($value as $v) {
6115  $cols = ',' . sizeof($v);
6116  $nv = array_merge($nv, $v);
6117  }
6118  $value = $nv;
6119  } else {
6120  $cols = '';
6121  }
6122  if (is_array($value) && sizeof($value) >= 1) {
6123  $rows = sizeof($value);
6124  $contents = '';
6125  foreach ($value as $k => $v) {
6126  $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
6127  //if (strpos($typeDef['arrayType'], ':') ) {
6128  if (!in_array($typeDef['arrayType'], $this->typemap['http://www.w3.org/2001/XMLSchema'])) {
6129  $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
6130  } else {
6131  $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use);
6132  }
6133  }
6134  } else {
6135  $rows = 0;
6136  $contents = null;
6137  }
6138  // TODO: for now, an empty value will be serialized as a zero element
6139  // array. Revisit this when coding the handling of null/nil values.
6140  if ($use == 'literal') {
6141  $xml = "<$name$elementNS>"
6142  . $contents
6143  . "</$name>";
6144  } else {
6145  $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . ':Array" ' .
6146  $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/')
6147  . ':arrayType="'
6148  . $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType']))
6149  . ":" . $this->getLocalPart($typeDef['arrayType']) . "[$rows$cols]\">"
6150  . $contents
6151  . "</$name>";
6152  }
6153  } elseif ($phpType == 'scalar') {
6154  if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
6155  $elementNS = " xmlns=\"$ns\"";
6156  } else {
6157  if ($unqualified) {
6158  $elementNS = " xmlns=\"\"";
6159  } else {
6160  $elementNS = '';
6161  }
6162  }
6163  if ($use == 'literal') {
6164  if ($forceType) {
6165  $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
6166  } else {
6167  $xml = "<$name$elementNS>$value</$name>";
6168  }
6169  } else {
6170  $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
6171  }
6172  }
6173  $this->debug("in serializeType: returning: $xml");
6174  return $xml;
6175  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:263
setError($str)
sets error string
Definition: nusoap.php:353
getTypeDef($type, $ns)
returns an array of information about a given type returns false if no type exists by the given name ...
Definition: nusoap.php:5269
serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false)
serializes the elements for a complexType
Definition: nusoap.php:6250
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:779
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
getPrefixFromNamespace($ns)
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given...
Definition: nusoap.php:830
serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
serializes a PHP value according a given type definition
Definition: nusoap.php:5883
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:867
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:797
expandEntities($val)
expands entities, e.g.
Definition: nusoap.php:321
serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType)
serializes the attributes for a complexType
Definition: nusoap.php:6187
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:813
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
+ Here is the call graph for this function:

◆ setCredentials()

wsdl::setCredentials (   $username,
  $password,
  $authtype = 'basic',
  $certRequest = array() 
)

if authenticating, set user credentials here

Parameters
string$username
string$password
string$authtype(basic|digest|certificate|ntlm)
array$certRequest(keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) public

Definition at line 5142 of file nusoap.php.

References nusoap_base\appendDebug(), nusoap_base\debug(), and nusoap_base\varDump().

Referenced by nusoap_client\loadWSDL().

5143  {
5144  $this->debug("setCredentials username=$username authtype=$authtype certRequest=");
5145  $this->appendDebug($this->varDump($certRequest));
5146  $this->username = $username;
5147  $this->password = $password;
5148  $this->authtype = $authtype;
5149  $this->certRequest = $certRequest;
5150  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:263
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
$password
Definition: nusoap.php:4630
$authtype
Definition: nusoap.php:4631
$username
Definition: nusoap.php:4629
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:867
$certRequest
Definition: nusoap.php:4632
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start_element()

wsdl::start_element (   $parser,
  $name,
  $attrs 
)

start-element handler

Parameters
string$parserXML parser object
string$nameelement name
string$attrsassociative array of attributes private

Definition at line 4878 of file nusoap.php.

References $namespace, nusoap_base\appendDebug(), nusoap_base\debug(), nusoap_base\expandQname(), nusoap_base\getLocalPart(), and nusoap_base\getPrefixFromNamespace().

4879  {
4880  if ($this->status == 'schema') {
4881  $this->currentSchema->schemaStartElement($parser, $name, $attrs);
4882  $this->appendDebug($this->currentSchema->getDebug());
4883  $this->currentSchema->clearDebug();
4884  } elseif (preg_match('/schema$/', $name)) {
4885  $this->debug('Parsing WSDL schema');
4886  // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")");
4887  $this->status = 'schema';
4888  $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces);
4889  $this->currentSchema->schemaStartElement($parser, $name, $attrs);
4890  $this->appendDebug($this->currentSchema->getDebug());
4891  $this->currentSchema->clearDebug();
4892  } else {
4893  // position in the total number of elements, starting from 0
4894  $pos = $this->position++;
4895  $depth = $this->depth++;
4896  // set self as current value for this depth
4897  $this->depth_array[$depth] = $pos;
4898  $this->message[$pos] = array('cdata' => '');
4899  // process attributes
4900  if (count($attrs) > 0) {
4901  // register namespace declarations
4902  foreach ($attrs as $k => $v) {
4903  if (preg_match('/^xmlns/', $k)) {
4904  if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
4905  $this->namespaces[$ns_prefix] = $v;
4906  } else {
4907  $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
4908  }
4909  if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
4910  $this->XMLSchemaVersion = $v;
4911  $this->namespaces['xsi'] = $v . '-instance';
4912  }
4913  }
4914  }
4915  // expand each attribute prefix to its namespace
4916  foreach ($attrs as $k => $v) {
4917  $k = strpos($k, ':') ? $this->expandQname($k) : $k;
4918  if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') {
4919  $v = strpos($v, ':') ? $this->expandQname($v) : $v;
4920  }
4921  $eAttrs[$k] = $v;
4922  }
4923  $attrs = $eAttrs;
4924  } else {
4925  $attrs = array();
4926  }
4927  // get element prefix, namespace and name
4928  if (preg_match('/:/', $name)) {
4929  // get ns prefix
4930  $prefix = substr($name, 0, strpos($name, ':'));
4931  // get ns
4932  $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : '';
4933  // get unqualified name
4934  $name = substr(strstr($name, ':'), 1);
4935  }
4936  // process attributes, expanding any prefixes to namespaces
4937  // find status, register data
4938  switch ($this->status) {
4939  case 'message':
4940  if ($name == 'part') {
4941  if (isset($attrs['type'])) {
4942  $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs));
4943  $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type'];
4944  }
4945  if (isset($attrs['element'])) {
4946  $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs));
4947  $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^';
4948  }
4949  }
4950  break;
4951  case 'portType':
4952  switch ($name) {
4953  case 'operation':
4954  $this->currentPortOperation = $attrs['name'];
4955  $this->debug("portType $this->currentPortType operation: $this->currentPortOperation");
4956  if (isset($attrs['parameterOrder'])) {
4957  $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder'];
4958  }
4959  break;
4960  case 'documentation':
4961  $this->documentation = true;
4962  break;
4963  // merge input/output data
4964  default:
4965  $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : '';
4966  $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m;
4967  break;
4968  }
4969  break;
4970  case 'binding':
4971  switch ($name) {
4972  case 'binding':
4973  // get ns prefix
4974  if (isset($attrs['style'])) {
4975  $this->bindings[$this->currentBinding]['prefix'] = $prefix;
4976  }
4977  $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs);
4978  break;
4979  case 'header':
4980  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs;
4981  break;
4982  case 'operation':
4983  if (isset($attrs['soapAction'])) {
4984  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction'];
4985  }
4986  if (isset($attrs['style'])) {
4987  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style'];
4988  }
4989  if (isset($attrs['name'])) {
4990  $this->currentOperation = $attrs['name'];
4991  $this->debug("current binding operation: $this->currentOperation");
4992  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name'];
4993  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding;
4994  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : '';
4995  }
4996  break;
4997  case 'input':
4998  $this->opStatus = 'input';
4999  break;
5000  case 'output':
5001  $this->opStatus = 'output';
5002  break;
5003  case 'body':
5004  if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) {
5005  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs);
5006  } else {
5007  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs;
5008  }
5009  break;
5010  }
5011  break;
5012  case 'service':
5013  switch ($name) {
5014  case 'port':
5015  $this->currentPort = $attrs['name'];
5016  $this->debug('current port: ' . $this->currentPort);
5017  $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']);
5018 
5019  break;
5020  case 'address':
5021  $this->ports[$this->currentPort]['location'] = $attrs['location'];
5022  $this->ports[$this->currentPort]['bindingType'] = $namespace;
5023  $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace;
5024  $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location'];
5025  break;
5026  }
5027  break;
5028  }
5029  // set status
5030  switch ($name) {
5031  case 'import':
5032  if (isset($attrs['location'])) {
5033  $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false);
5034  $this->debug('parsing import ' . $attrs['namespace'] . ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]) . ')');
5035  } else {
5036  $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
5037  if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
5038  $this->namespaces['ns' . (count($this->namespaces) + 1)] = $attrs['namespace'];
5039  }
5040  $this->debug('parsing import ' . $attrs['namespace'] . ' - [no location] (' . count($this->import[$attrs['namespace']]) . ')');
5041  }
5042  break;
5043  //wait for schema
5044  //case 'types':
5045  // $this->status = 'schema';
5046  // break;
5047  case 'message':
5048  $this->status = 'message';
5049  $this->messages[$attrs['name']] = array();
5050  $this->currentMessage = $attrs['name'];
5051  break;
5052  case 'portType':
5053  $this->status = 'portType';
5054  $this->portTypes[$attrs['name']] = array();
5055  $this->currentPortType = $attrs['name'];
5056  break;
5057  case "binding":
5058  if (isset($attrs['name'])) {
5059  // get binding name
5060  if (strpos($attrs['name'], ':')) {
5061  $this->currentBinding = $this->getLocalPart($attrs['name']);
5062  } else {
5063  $this->currentBinding = $attrs['name'];
5064  }
5065  $this->status = 'binding';
5066  $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']);
5067  $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']);
5068  }
5069  break;
5070  case 'service':
5071  $this->serviceName = $attrs['name'];
5072  $this->status = 'service';
5073  $this->debug('current service: ' . $this->serviceName);
5074  break;
5075  case 'definitions':
5076  foreach ($attrs as $name => $value) {
5077  $this->wsdl_info[$name] = $value;
5078  }
5079  break;
5080  }
5081  }
5082  }
if($err=$client->getError()) $namespace
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:263
$currentBinding
Definition: nusoap.php:4605
$depth
Definition: nusoap.php:4617
$currentPortType
Definition: nusoap.php:4603
$parser
Definition: nusoap.php:4615
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:779
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
$currentPort
Definition: nusoap.php:4607
getPrefixFromNamespace($ns)
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given...
Definition: nusoap.php:830
expandQname($qname)
expands (changes prefix to namespace) a qualified name
Definition: nusoap.php:753
parses an XML Schema, allows access to it&#39;s data, other utility methods.
Definition: nusoap.php:1085
$currentPortOperation
Definition: nusoap.php:4592
$opStatus
Definition: nusoap.php:4591
$currentOperation
Definition: nusoap.php:4601
$currentMessage
Definition: nusoap.php:4600
+ Here is the call graph for this function:

◆ webDescription()

wsdl::webDescription ( )

prints html description of services

private

Definition at line 5326 of file nusoap.php.

References $_SERVER, Vendor\Package\$b, $data, and nusoap_base\setError().

Referenced by nusoap_server\service().

5327  {
5328  global $HTTP_SERVER_VARS;
5329 
5330  if (isset($_SERVER)) {
5331  $PHP_SELF = $_SERVER['PHP_SELF'];
5332  } elseif (isset($HTTP_SERVER_VARS)) {
5333  $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
5334  } else {
5335  $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
5336  }
5337  // begin-patch: https://mantis.ilias.de/view.php?id=28866
5338  $PHP_SELF = htmlspecialchars($PHP_SELF, ENT_QUOTES | ENT_HTML5, 'UTF-8');
5339  // end-patch
5340 
5341  $b = '
5342  <html><head><title>NuSOAP: ' . $this->serviceName . '</title>
5343  <style type="text/css">
5344  body { font-family: arial; color: #000000; background-color: #ffffff; margin: 0px 0px 0px 0px; }
5345  p { font-family: arial; color: #000000; margin-top: 0px; margin-bottom: 12px; }
5346  pre { background-color: silver; padding: 5px; font-family: Courier New; font-size: x-small; color: #000000;}
5347  ul { margin-top: 10px; margin-left: 20px; }
5348  li { list-style-type: none; margin-top: 10px; color: #000000; }
5349  .content{
5350  margin-left: 0px; padding-bottom: 2em; }
5351  .nav {
5352  padding-top: 10px; padding-bottom: 10px; padding-left: 15px; font-size: .70em;
5353  margin-top: 10px; margin-left: 0px; color: #000000;
5354  background-color: #ccccff; width: 20%; margin-left: 20px; margin-top: 20px; }
5355  .title {
5356  font-family: arial; font-size: 26px; color: #ffffff;
5357  background-color: #999999; width: 105%; margin-left: 0px;
5358  padding-top: 10px; padding-bottom: 10px; padding-left: 15px;}
5359  .hidden {
5360  position: absolute; visibility: hidden; z-index: 200; left: 250px; top: 100px;
5361  font-family: arial; overflow: hidden; width: 600;
5362  padding: 20px; font-size: 10px; background-color: #999999;
5363  layer-background-color:#FFFFFF; }
5364  a,a:active { color: charcoal; font-weight: bold; }
5365  a:visited { color: #666666; font-weight: bold; }
5366  a:hover { color: cc3300; font-weight: bold; }
5367  </style>
5368  <script language="JavaScript" type="text/javascript">
5369  <!--
5370  // POP-UP CAPTIONS...
5371  function lib_bwcheck(){ //Browsercheck (needed)
5372  this.ver=navigator.appVersion
5373  this.agent=navigator.userAgent
5374  this.dom=document.getElementById?1:0
5375  this.opera5=this.agent.indexOf("Opera 5")>-1
5376  this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
5377  this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
5378  this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
5379  this.ie=this.ie4||this.ie5||this.ie6
5380  this.mac=this.agent.indexOf("Mac")>-1
5381  this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
5382  this.ns4=(document.layers && !this.dom)?1:0;
5383  this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
5384  return this
5385  }
5386  var bw = new lib_bwcheck()
5387  //Makes crossbrowser object.
5388  function makeObj(obj){
5389  this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
5390  if(!this.evnt) return false
5391  this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;
5392  this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;
5393  this.writeIt=b_writeIt;
5394  return this
5395  }
5396  // A unit of measure that will be added when setting the position of a layer.
5397  //var px = bw.ns4||window.opera?"":"px";
5398  function b_writeIt(text){
5399  if (bw.ns4){this.wref.write(text);this.wref.close()}
5400  else this.wref.innerHTML = text
5401  }
5402  //Shows the messages
5403  var oDesc;
5404  function popup(divid){
5405  if(oDesc = new makeObj(divid)){
5406  oDesc.css.visibility = "visible"
5407  }
5408  }
5409  function popout(){ // Hides message
5410  if(oDesc) oDesc.css.visibility = "hidden"
5411  }
5412  //-->
5413  </script>
5414  </head>
5415  <body>
5416  <div class=content>
5417  <br><br>
5418  <div class=title>' . $this->serviceName . '</div>
5419  <div class=nav>
5420  <p>View the <a href="' . $PHP_SELF . '?wsdl">WSDL</a> for the service.
5421  Click on an operation name to view it&apos;s details.</p>
5422  <ul>';
5423  foreach ($this->getOperations() as $op => $data) {
5424  // begin-patch: https://mantis.ilias.de/view.php?id=28866
5425  if (isset($data['endpoint'])) {
5426  $data['endpoint'] = htmlspecialchars($data['endpoint'], ENT_QUOTES | ENT_HTML5, 'UTF-8');
5427  }
5428  // end-patch
5429  $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>";
5430  // create hidden div
5431  $b .= "<div id='$op' class='hidden'>
5432  <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>";
5433  foreach ($data as $donnie => $marie) { // loop through opdata
5434  if ($donnie == 'input' || $donnie == 'output') { // show input/output data
5435  $b .= "<font color='white'>" . ucfirst($donnie) . ':</font><br>';
5436  foreach ($marie as $captain => $tenille) { // loop through data
5437  if ($captain == 'parts') { // loop thru parts
5438  $b .= "&nbsp;&nbsp;$captain:<br>";
5439  //if(is_array($tenille)){
5440  foreach ($tenille as $joanie => $chachi) {
5441  $b .= "&nbsp;&nbsp;&nbsp;&nbsp;$joanie: $chachi<br>";
5442  }
5443  //}
5444  } else {
5445  $b .= "&nbsp;&nbsp;$captain: $tenille<br>";
5446  }
5447  }
5448  } else {
5449  $b .= "<font color='white'>" . ucfirst($donnie) . ":</font> $marie<br>";
5450  }
5451  }
5452  $b .= '</div>';
5453  }
5454  $b .= '
5455  <ul>
5456  </div>
5457  </div></body></html>';
5458  return $b;
5459  }
setError($str)
sets error string
Definition: nusoap.php:353
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26
getOperations($bindingType='soap')
returns an assoc array of operation names => operation data
Definition: nusoap.php:5166
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $authtype

wsdl::$authtype = ''

Definition at line 4631 of file nusoap.php.

◆ $bindings

wsdl::$bindings = array()

Definition at line 4604 of file nusoap.php.

◆ $certRequest

wsdl::$certRequest = array()

Definition at line 4632 of file nusoap.php.

◆ $complexTypes

wsdl::$complexTypes = array()

Definition at line 4598 of file nusoap.php.

◆ $curl_options

wsdl::$curl_options = array()

Definition at line 4626 of file nusoap.php.

◆ $currentBinding

wsdl::$currentBinding

Definition at line 4605 of file nusoap.php.

◆ $currentMessage

wsdl::$currentMessage

Definition at line 4600 of file nusoap.php.

◆ $currentOperation

wsdl::$currentOperation

Definition at line 4601 of file nusoap.php.

◆ $currentPort

wsdl::$currentPort

Definition at line 4607 of file nusoap.php.

◆ $currentPortOperation

wsdl::$currentPortOperation

Definition at line 4592 of file nusoap.php.

◆ $currentPortType

wsdl::$currentPortType

Definition at line 4603 of file nusoap.php.

◆ $currentSchema

wsdl::$currentSchema

Definition at line 4596 of file nusoap.php.

◆ $depth

wsdl::$depth = 0

Definition at line 4617 of file nusoap.php.

◆ $depth_array

wsdl::$depth_array = array()

Definition at line 4618 of file nusoap.php.

◆ $documentation

wsdl::$documentation = false

Definition at line 4610 of file nusoap.php.

◆ $endpoint

wsdl::$endpoint = ''

Definition at line 4611 of file nusoap.php.

◆ $import

wsdl::$import = array()

Definition at line 4613 of file nusoap.php.

◆ $message

wsdl::$message = array()

Definition at line 4597 of file nusoap.php.

◆ $messages

wsdl::$messages = array()

Definition at line 4599 of file nusoap.php.

◆ $opData

wsdl::$opData = array()

Definition at line 4608 of file nusoap.php.

◆ $opStatus

wsdl::$opStatus

Definition at line 4591 of file nusoap.php.

◆ $parser

wsdl::$parser

Definition at line 4615 of file nusoap.php.

◆ $password

wsdl::$password = ''

Definition at line 4630 of file nusoap.php.

◆ $ports

wsdl::$ports = array()

Definition at line 4606 of file nusoap.php.

◆ $portTypes

wsdl::$portTypes = array()

Definition at line 4602 of file nusoap.php.

◆ $position

wsdl::$position = 0

Definition at line 4616 of file nusoap.php.

◆ $proxyhost

wsdl::$proxyhost = ''

Definition at line 4620 of file nusoap.php.

◆ $proxypassword

wsdl::$proxypassword = ''

Definition at line 4623 of file nusoap.php.

◆ $proxyport

wsdl::$proxyport = ''

Definition at line 4621 of file nusoap.php.

◆ $proxyusername

wsdl::$proxyusername = ''

Definition at line 4622 of file nusoap.php.

◆ $response_timeout

wsdl::$response_timeout = 30

Definition at line 4625 of file nusoap.php.

◆ $schemas

wsdl::$schemas = array()

Definition at line 4595 of file nusoap.php.

◆ $serviceName

wsdl::$serviceName

Definition at line 4590 of file nusoap.php.

◆ $status

wsdl::$status = ''

Definition at line 4609 of file nusoap.php.

◆ $timeout

wsdl::$timeout = 0

Definition at line 4624 of file nusoap.php.

◆ $use_curl

wsdl::$use_curl = false

Definition at line 4627 of file nusoap.php.

◆ $username

wsdl::$username = ''

Definition at line 4629 of file nusoap.php.

◆ $wsdl

wsdl::$wsdl

Definition at line 4593 of file nusoap.php.


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