ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 4630 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 4691 of file nusoap.php.

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

4692  {
4694  $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
4695  $this->proxyhost = $proxyhost;
4696  $this->proxyport = $proxyport;
4697  $this->proxyusername = $proxyusername;
4698  $this->proxypassword = $proxypassword;
4699  $this->timeout = $timeout;
4700  $this->response_timeout = $response_timeout;
4701  if (is_array($curl_options)) {
4702  $this->curl_options = $curl_options;
4703  }
4704  $this->use_curl = $use_curl;
4705  $this->fetchWSDL($wsdl);
4706  }
$proxyhost
Definition: nusoap.php:4663
$wsdl
Definition: nusoap.php:4636
$use_curl
Definition: nusoap.php:4670
$proxyusername
Definition: nusoap.php:4665
$curl_options
Definition: nusoap.php:4669
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:290
$proxyport
Definition: nusoap.php:4664
$response_timeout
Definition: nusoap.php:4668
$timeout
Definition: nusoap.php:4667
__construct(Container $dic, ilPlugin $plugin)
fetchWSDL($wsdl)
fetches the WSDL document and parses it
Definition: nusoap.php:4713
$proxypassword
Definition: nusoap.php:4666
+ 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 6397 of file nusoap.php.

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

6398  {
6399  if (count($elements) > 0) {
6400  $eElements = array();
6401  foreach ($elements as $n => $e) {
6402  // expand each element
6403  $ee = array();
6404  foreach ($e as $k => $v) {
6405  $k = strpos($k, ':') ? $this->expandQname($k) : $k;
6406  $v = strpos($v, ':') ? $this->expandQname($v) : $v;
6407  $ee[$k] = $v;
6408  }
6409  $eElements[$n] = $ee;
6410  }
6411  $elements = $eElements;
6412  }
6413 
6414  if (count($attrs) > 0) {
6415  foreach ($attrs as $n => $a) {
6416  // expand each attribute
6417  foreach ($a as $k => $v) {
6418  $k = strpos($k, ':') ? $this->expandQname($k) : $k;
6419  $v = strpos($v, ':') ? $this->expandQname($v) : $v;
6420  $aa[$k] = $v;
6421  }
6422  $eAttrs[$n] = $aa;
6423  }
6424  $attrs = $eAttrs;
6425  }
6426 
6427  $restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase;
6428  $arrayType = strpos($arrayType, ':') ? $this->expandQname($arrayType) : $arrayType;
6429 
6430  $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6431  $this->schemas[$typens][0]->addComplexType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs, $arrayType);
6432  }
expandQname($qname)
expands (changes prefix to namespace) a qualified name
Definition: nusoap.php:793
$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 6460 of file nusoap.php.

6461  {
6462  $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6463  $this->schemas[$typens][0]->addElement($attrs);
6464  }

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

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

Referenced by nusoap_server\register().

6481  {
6482  if ($use == 'encoded' && $encodingStyle == '') {
6483  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
6484  }
6485 
6486  if ($style == 'document') {
6487  $elements = array();
6488  foreach ($in as $n => $t) {
6489  $elements[$n] = array('name' => $n, 'type' => $t);
6490  }
6491  $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements);
6492  $this->addElement(array('name' => $name, 'type' => $name . 'RequestType'));
6493  $in = array('parameters' => 'tns:' . $name . '^');
6494 
6495  $elements = array();
6496  foreach ($out as $n => $t) {
6497  $elements[$n] = array('name' => $n, 'type' => $t);
6498  }
6499  $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements);
6500  $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified'));
6501  $out = array('parameters' => 'tns:' . $name . 'Response' . '^');
6502  }
6503 
6504  // get binding
6505  $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] =
6506  array(
6507  'name' => $name,
6508  'binding' => $this->serviceName . 'Binding',
6509  'endpoint' => $this->endpoint,
6510  'soapAction' => $soapaction,
6511  'style' => $style,
6512  'input' => array(
6513  'use' => $use,
6514  'namespace' => $namespace,
6515  'encodingStyle' => $encodingStyle,
6516  'message' => $name . 'Request',
6517  'parts' => $in),
6518  'output' => array(
6519  'use' => $use,
6520  'namespace' => $namespace,
6521  'encodingStyle' => $encodingStyle,
6522  'message' => $name . 'Response',
6523  'parts' => $out),
6524  'namespace' => $namespace,
6525  'transport' => 'http://schemas.xmlsoap.org/soap/http',
6526  'documentation' => $documentation);
6527  // add portTypes
6528  // add messages
6529  if ($in) {
6530  foreach ($in as $pName => $pType) {
6531  if (strpos($pType, ':')) {
6532  $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)) . ":" . $this->getLocalPart($pType);
6533  }
6534  $this->messages[$name . 'Request'][$pName] = $pType;
6535  }
6536  } else {
6537  $this->messages[$name . 'Request']= '0';
6538  }
6539  if ($out) {
6540  foreach ($out as $pName => $pType) {
6541  if (strpos($pType, ':')) {
6542  $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)) . ":" . $this->getLocalPart($pType);
6543  }
6544  $this->messages[$name . 'Response'][$pName] = $pType;
6545  }
6546  } else {
6547  $this->messages[$name . 'Response']= '0';
6548  }
6549  return true;
6550  }
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:6397
$documentation
Definition: nusoap.php:4653
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:819
addElement($attrs)
adds an element to the WSDL types
Definition: nusoap.php:6460
$out
Definition: buildRTE.php:24
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:837
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:853
+ 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 6445 of file nusoap.php.

References nusoap_base\expandQname().

6446  {
6447  $restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase;
6448 
6449  $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6450  $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration);
6451  }
expandQname($qname)
expands (changes prefix to namespace) a qualified name
Definition: nusoap.php:793
+ 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 5166 of file nusoap.php.

References $data.

5167  {
5168  $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
5169  if (isset($this->message[$pos]['cdata'])) {
5170  $this->message[$pos]['cdata'] .= $data;
5171  }
5172  if ($this->documentation) {
5173  $this->documentation .= $data;
5174  }
5175  }
$depth
Definition: nusoap.php:4660

◆ end_element()

wsdl::end_element (   $parser,
  $name 
)

end-element handler

Parameters
string$parserXML parser object
string$nameelement name private

Definition at line 5135 of file nusoap.php.

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

5136  {
5137  // unset schema status
5138  if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) {
5139  $this->status = "";
5140  $this->appendDebug($this->currentSchema->getDebug());
5141  $this->currentSchema->clearDebug();
5142  $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
5143  $this->debug('Parsing WSDL schema done');
5144  }
5145  if ($this->status == 'schema') {
5146  $this->currentSchema->schemaEndElement($parser, $name);
5147  } else {
5148  // bring depth down a notch
5149  $this->depth--;
5150  }
5151  // end documentation
5152  if ($this->documentation) {
5153  //TODO: track the node to which documentation should be assigned; it can be a part, message, etc.
5154  //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation;
5155  $this->documentation = false;
5156  }
5157  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:303
$currentSchema
Definition: nusoap.php:4639
$parser
Definition: nusoap.php:4658
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:290
+ Here is the call graph for this function:

◆ fetchWSDL()

wsdl::fetchWSDL (   $wsdl)

fetches the WSDL document and parses it

public

Definition at line 4713 of file nusoap.php.

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

Referenced by nusoap_client\loadWSDL().

4714  {
4715  $this->debug("parse and process WSDL path=$wsdl");
4716  $this->wsdl = $wsdl;
4717  // parse wsdl file
4718  if ($this->wsdl != "") {
4719  $this->parseWSDL($this->wsdl);
4720  }
4721  // imports
4722  // TODO: handle imports more properly, grabbing them in-line and nesting them
4723  $imported_urls = array();
4724  $imported = 1;
4725  while ($imported > 0) {
4726  $imported = 0;
4727  // Schema imports
4728  foreach ($this->schemas as $ns => $list) {
4729  foreach ($list as $xs) {
4730  $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
4731  foreach ($xs->imports as $ns2 => $list2) {
4732  for ($ii = 0; $ii < count($list2); $ii++) {
4733  if (! $list2[$ii]['loaded']) {
4734  $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
4735  $url = $list2[$ii]['location'];
4736  if ($url != '') {
4737  $urlparts = parse_url($url);
4738  if (!isset($urlparts['host'])) {
4739  $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') .
4740  substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1) . $urlparts['path'];
4741  }
4742  if (! in_array($url, $imported_urls)) {
4743  $this->parseWSDL($url);
4744  $imported++;
4745  $imported_urls[] = $url;
4746  }
4747  } else {
4748  $this->debug("Unexpected scenario: empty URL for unloaded import");
4749  }
4750  }
4751  }
4752  }
4753  }
4754  }
4755  // WSDL imports
4756  $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
4757  foreach ($this->import as $ns => $list) {
4758  for ($ii = 0; $ii < count($list); $ii++) {
4759  if (! $list[$ii]['loaded']) {
4760  $this->import[$ns][$ii]['loaded'] = true;
4761  $url = $list[$ii]['location'];
4762  if ($url != '') {
4763  $urlparts = parse_url($url);
4764  if (!isset($urlparts['host'])) {
4765  $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') .
4766  substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1) . $urlparts['path'];
4767  }
4768  if (! in_array($url, $imported_urls)) {
4769  $this->parseWSDL($url);
4770  $imported++;
4771  $imported_urls[] = $url;
4772  }
4773  } else {
4774  $this->debug("Unexpected scenario: empty URL for unloaded import");
4775  }
4776  }
4777  }
4778  }
4779  }
4780  // add new data to operation data
4781  foreach ($this->bindings as $binding => $bindingData) {
4782  if (isset($bindingData['operations']) && is_array($bindingData['operations'])) {
4783  foreach ($bindingData['operations'] as $operation => $data) {
4784  $this->debug('post-parse data gathering for ' . $operation);
4785  $this->bindings[$binding]['operations'][$operation]['input'] =
4786  isset($this->bindings[$binding]['operations'][$operation]['input']) ?
4787  array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) :
4788  $this->portTypes[ $bindingData['portType'] ][$operation]['input'];
4789  $this->bindings[$binding]['operations'][$operation]['output'] =
4790  isset($this->bindings[$binding]['operations'][$operation]['output']) ?
4791  array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) :
4792  $this->portTypes[ $bindingData['portType'] ][$operation]['output'];
4793  if (isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])) {
4794  $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ];
4795  }
4796  if (isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])) {
4797  $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ];
4798  }
4799  // Set operation style if necessary, but do not override one already provided
4800  if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) {
4801  $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style'];
4802  }
4803  $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : '';
4804  $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : '';
4805  $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : '';
4806  }
4807  }
4808  }
4809  }
$wsdl
Definition: nusoap.php:4636
parses a WSDL file, allows access to it&#39;s data, other utility methods.
Definition: nusoap.php:4630
parseWSDL($wsdl='')
parses the wsdl document
Definition: nusoap.php:4817
$url
Definition: shib_logout.php:63
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:290
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBindingData()

wsdl::getBindingData (   $binding)

Definition at line 5196 of file nusoap.php.

5197  {
5198  if (is_array($this->bindings[$binding])) {
5199  return $this->bindings[$binding];
5200  }
5201  }

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

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

5243  {
5244  if ($bindingType == 'soap') {
5245  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
5246  } elseif ($bindingType == 'soap12') {
5247  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
5248  }
5249  // loop thru ports
5250  foreach ($this->ports as $port => $portData) {
5251  // binding type of port matches parameter
5252  if ($portData['bindingType'] == $bindingType) {
5253  // get binding
5254  //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
5255  foreach (array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) {
5256  // note that we could/should also check the namespace here
5257  if ($operation == $bOperation) {
5258  $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
5259  return $opData;
5260  }
5261  }
5262  }
5263  }
5264  }
$opData
Definition: nusoap.php:4651
+ 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 5274 of file nusoap.php.

Referenced by nusoap_server\invoke_method().

5275  {
5276  if ($bindingType == 'soap') {
5277  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
5278  } elseif ($bindingType == 'soap12') {
5279  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
5280  }
5281  // loop thru ports
5282  foreach ($this->ports as $port => $portData) {
5283  // binding type of port matches parameter
5284  if ($portData['bindingType'] == $bindingType) {
5285  // loop through operations for the binding
5286  foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
5287  if ($opData['soapAction'] == $soapAction) {
5288  return $opData;
5289  }
5290  }
5291  }
5292  }
5293  }
$opData
Definition: nusoap.php:4651
+ 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 5210 of file nusoap.php.

Referenced by nusoap_client\checkWSDL().

5211  {
5212  $ops = array();
5213  if ($bindingType == 'soap') {
5214  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
5215  } elseif ($bindingType == 'soap12') {
5216  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
5217  }
5218  // loop thru ports
5219  foreach ($this->ports as $port => $portData) {
5220  // binding type of port matches parameter
5221  if ($portData['bindingType'] == $bindingType) {
5222  //$this->debug("getOperations for port $port");
5223  //$this->debug("port data: " . $this->varDump($portData));
5224  //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ]));
5225  // merge bindings
5226  if (isset($this->bindings[ $portData['binding'] ]['operations'])) {
5227  $ops = array_merge($ops, $this->bindings[ $portData['binding'] ]['operations']);
5228  }
5229  }
5230  }
5231  return $ops;
5232  }
+ 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 5313 of file nusoap.php.

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

5314  {
5315  $this->debug("in getTypeDef: type=$type, ns=$ns");
5316  if ((! $ns) && isset($this->namespaces['tns'])) {
5317  $ns = $this->namespaces['tns'];
5318  $this->debug("in getTypeDef: type namespace forced to $ns");
5319  }
5320  if (!isset($this->schemas[$ns])) {
5321  foreach ($this->schemas as $ns0 => $schema0) {
5322  if (strcasecmp($ns, $ns0) == 0) {
5323  $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0");
5324  $ns = $ns0;
5325  break;
5326  }
5327  }
5328  }
5329  if (isset($this->schemas[$ns])) {
5330  $this->debug("in getTypeDef: have schema for namespace $ns");
5331  for ($i = 0; $i < count($this->schemas[$ns]); $i++) {
5332  $xs = &$this->schemas[$ns][$i];
5333  $t = $xs->getTypeDef($type);
5334  //$this->appendDebug($xs->getDebug());
5335  //$xs->clearDebug();
5336  if ($t) {
5337  if (!isset($t['phpType'])) {
5338  // get info for type to tack onto the element
5339  $uqType = substr($t['type'], strrpos($t['type'], ':') + 1);
5340  $ns = substr($t['type'], 0, strrpos($t['type'], ':'));
5341  $etype = $this->getTypeDef($uqType, $ns);
5342  if ($etype) {
5343  $this->debug("found type for [element] $type:");
5344  $this->debug($this->varDump($etype));
5345  if (isset($etype['phpType'])) {
5346  $t['phpType'] = $etype['phpType'];
5347  }
5348  if (isset($etype['elements'])) {
5349  $t['elements'] = $etype['elements'];
5350  }
5351  if (isset($etype['attrs'])) {
5352  $t['attrs'] = $etype['attrs'];
5353  }
5354  }
5355  }
5356  return $t;
5357  }
5358  }
5359  } else {
5360  $this->debug("in getTypeDef: do not have schema for namespace $ns");
5361  }
5362  return false;
5363  }
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:5313
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:290
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:907
+ 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 5660 of file nusoap.php.

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

5661  {
5662  $this->debug("in parametersMatchWrapped type=$type, parameters=");
5663  $this->appendDebug($this->varDump($parameters));
5664 
5665  // split type into namespace:unqualified-type
5666  if (strpos($type, ':')) {
5667  $uqType = substr($type, strrpos($type, ':') + 1);
5668  $ns = substr($type, 0, strrpos($type, ':'));
5669  $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns");
5670  if ($this->getNamespaceFromPrefix($ns)) {
5671  $ns = $this->getNamespaceFromPrefix($ns);
5672  $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns");
5673  }
5674  } else {
5675  // TODO: should the type be compared to types in XSD, and the namespace
5676  // set to XSD if the type matches?
5677  $this->debug("in parametersMatchWrapped: No namespace for type $type");
5678  $ns = '';
5679  $uqType = $type;
5680  }
5681 
5682  // get the type information
5683  if (!$typeDef = $this->getTypeDef($uqType, $ns)) {
5684  $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type.");
5685  return false;
5686  }
5687  $this->debug("in parametersMatchWrapped: found typeDef=");
5688  $this->appendDebug($this->varDump($typeDef));
5689  if (substr($uqType, -1) == '^') {
5690  $uqType = substr($uqType, 0, -1);
5691  }
5692  $phpType = $typeDef['phpType'];
5693  $arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '');
5694  $this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType");
5695 
5696  // we expect a complexType or element of complexType
5697  if ($phpType != 'struct') {
5698  $this->debug("in parametersMatchWrapped: not a struct");
5699  return false;
5700  }
5701 
5702  // see whether the parameter names match the elements
5703  if (isset($typeDef['elements']) && is_array($typeDef['elements'])) {
5704  $elements = 0;
5705  $matches = 0;
5706  $change = false;
5707  if ($this->isArraySimpleOrStruct($parameters) == 'arraySimple' && count($parameters) == count($typeDef['elements'])) {
5708  $this->debug("in parametersMatchWrapped: (wrapped return value kludge) correct number of elements in simple array, so change array and wrap");
5709  $change = true;
5710  }
5711  foreach ($typeDef['elements'] as $name => $attrs) {
5712  if ($change) {
5713  $this->debug("in parametersMatchWrapped: change parameter $element to name $name");
5714  $parameters[$name] = $parameters[$elements];
5715  unset($parameters[$elements]);
5716  $matches++;
5717  } elseif (isset($parameters[$name])) {
5718  $this->debug("in parametersMatchWrapped: have parameter named $name");
5719  $matches++;
5720  } else {
5721  $this->debug("in parametersMatchWrapped: do not have parameter named $name");
5722  }
5723  $elements++;
5724  }
5725 
5726  $this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped parameter names");
5727  if ($matches == 0) {
5728  return false;
5729  }
5730  return true;
5731  }
5732 
5733  // since there are no elements for the type, if the user passed no
5734  // parameters, the parameters match wrapped.
5735  $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType");
5736  return count($parameters) == 0;
5737  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:303
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:5313
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:405
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:290
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:907
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:853
+ 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 4817 of file nusoap.php.

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

4818  {
4819  $this->debug("parse WSDL at path=$wsdl");
4820 
4821  if ($wsdl == '') {
4822  $this->debug('no wsdl passed to parseWSDL()!!');
4823  $this->setError('no wsdl passed to parseWSDL()!!');
4824  return false;
4825  }
4826 
4827  // parse $wsdl for url format
4828  $wsdl_props = parse_url($wsdl);
4829 
4830  if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) {
4831  $this->debug('getting WSDL http(s) URL ' . $wsdl);
4832  // get wsdl
4833  $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl);
4834  $tr->request_method = 'GET';
4835  $tr->useSOAPAction = false;
4836  if ($this->proxyhost && $this->proxyport) {
4837  $tr->setProxy($this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword);
4838  }
4839  if ($this->authtype != '') {
4840  $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
4841  }
4842  $tr->setEncoding('gzip, deflate');
4843  $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout);
4844  //$this->debug("WSDL request\n" . $tr->outgoing_payload);
4845  //$this->debug("WSDL response\n" . $tr->incoming_payload);
4846  $this->appendDebug($tr->getDebug());
4847  // catch errors
4848  if ($err = $tr->getError()) {
4849  $errstr = 'HTTP ERROR: ' . $err;
4850  $this->debug($errstr);
4851  $this->setError($errstr);
4852  unset($tr);
4853  return false;
4854  }
4855  unset($tr);
4856  $this->debug("got WSDL URL");
4857  } else {
4858  // $wsdl is not http(s), so treat it as a file URL or plain file path
4859  if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) {
4860  $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path'];
4861  } else {
4862  $path = $wsdl;
4863  }
4864  $this->debug('getting WSDL file ' . $path);
4865  if ($fp = @fopen($path, 'r')) {
4866  $wsdl_string = '';
4867  while ($data = fread($fp, 32768)) {
4868  $wsdl_string .= $data;
4869  }
4870  fclose($fp);
4871  } else {
4872  $errstr = "Bad path to WSDL file $path";
4873  $this->debug($errstr);
4874  $this->setError($errstr);
4875  return false;
4876  }
4877  }
4878  $this->debug('Parse WSDL');
4879  // end new code added
4880  // Create an XML parser.
4881  $this->parser = xml_parser_create();
4882  // Set the options for parsing the XML data.
4883  // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
4884  xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
4885  // Set the object for the parser.
4886  xml_set_object($this->parser, $this);
4887  // Set the element handlers for the parser.
4888  xml_set_element_handler($this->parser, 'start_element', 'end_element');
4889  xml_set_character_data_handler($this->parser, 'character_data');
4890  // Parse the XML file.
4891  if (!xml_parse($this->parser, $wsdl_string, true)) {
4892  // Display an error message.
4893  $errstr = sprintf(
4894  'XML error parsing WSDL from %s on line %d: %s',
4895  $wsdl,
4896  xml_get_current_line_number($this->parser),
4897  xml_error_string(xml_get_error_code($this->parser))
4898  );
4899  $this->debug($errstr);
4900  $this->debug("XML payload:\n" . $wsdl_string);
4901  $this->setError($errstr);
4902  return false;
4903  }
4904  // free the parser
4905  xml_parser_free($this->parser);
4906  $this->debug('Parsing WSDL done');
4907  // catch wsdl parse errors
4908  if ($this->getError()) {
4909  return false;
4910  }
4911  return true;
4912  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:303
setError($str)
sets error string
Definition: nusoap.php:393
$wsdl
Definition: nusoap.php:4636
transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CUR...
Definition: nusoap.php:2183
$path
Definition: ltiservices.php:30
getError()
returns error string if present
Definition: nusoap.php:379
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:290
+ 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 5512 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().

5513  {
5514  $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>';
5515  $xml .= "\n<definitions";
5516  foreach ($this->namespaces as $k => $v) {
5517  $xml .= " xmlns:$k=\"$v\"";
5518  }
5519  // 10.9.02 - add poulter fix for wsdl and tns declarations
5520  if (isset($this->namespaces['wsdl'])) {
5521  $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
5522  }
5523  if (isset($this->namespaces['tns'])) {
5524  $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
5525  }
5526  $xml .= '>';
5527  // imports
5528  if (sizeof($this->import) > 0) {
5529  foreach ($this->import as $ns => $list) {
5530  foreach ($list as $ii) {
5531  if ($ii['location'] != '') {
5532  $xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />';
5533  } else {
5534  $xml .= '<import namespace="' . $ns . '" />';
5535  }
5536  }
5537  }
5538  }
5539  // types
5540  if (count($this->schemas)>=1) {
5541  $xml .= "\n<types>\n";
5542  foreach ($this->schemas as $ns => $list) {
5543  foreach ($list as $xs) {
5544  $xml .= $xs->serializeSchema();
5545  }
5546  }
5547  $xml .= '</types>';
5548  }
5549  // messages
5550  if (count($this->messages) >= 1) {
5551  foreach ($this->messages as $msgName => $msgParts) {
5552  $xml .= "\n<message name=\"" . $msgName . '">';
5553  if (is_array($msgParts)) {
5554  foreach ($msgParts as $partName => $partType) {
5555  // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>';
5556  if (strpos($partType, ':')) {
5557  $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType));
5558  } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) {
5559  // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>';
5560  $typePrefix = 'xsd';
5561  } else {
5562  foreach ($this->typemap as $ns => $types) {
5563  if (isset($types[$partType])) {
5564  $typePrefix = $this->getPrefixFromNamespace($ns);
5565  }
5566  }
5567  if (!isset($typePrefix)) {
5568  die("$partType has no namespace!");
5569  }
5570  }
5571  $ns = $this->getNamespaceFromPrefix($typePrefix);
5572  $localPart = $this->getLocalPart($partType);
5573  $typeDef = $this->getTypeDef($localPart, $ns);
5574  if (($typeDef['typeClass'] ?? '') == 'element') {
5575  $elementortype = 'element';
5576  if (substr($localPart, -1) == '^') {
5577  $localPart = substr($localPart, 0, -1);
5578  }
5579  } else {
5580  $elementortype = 'type';
5581  }
5582  $xml .= "\n" . ' <part name="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $localPart . '" />';
5583  }
5584  }
5585  $xml .= '</message>';
5586  }
5587  }
5588  // bindings & porttypes
5589  if (count($this->bindings) >= 1) {
5590  $binding_xml = '';
5591  $portType_xml = '';
5592  foreach ($this->bindings as $bindingName => $attrs) {
5593  $binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">';
5594  $binding_xml .= "\n" . ' <soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>';
5595  $portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">';
5596  foreach ($attrs['operations'] as $opName => $opParts) {
5597  $binding_xml .= "\n" . ' <operation name="' . $opName . '">';
5598  $binding_xml .= "\n" . ' <soap:operation soapAction="' . $opParts['soapAction'] . '" style="' . $opParts['style'] . '"/>';
5599  if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') {
5600  $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"';
5601  } else {
5602  $enc_style = '';
5603  }
5604  $binding_xml .= "\n" . ' <input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>';
5605  if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') {
5606  $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"';
5607  } else {
5608  $enc_style = '';
5609  }
5610  $binding_xml .= "\n" . ' <output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>';
5611  $binding_xml .= "\n" . ' </operation>';
5612  $portType_xml .= "\n" . ' <operation name="' . $opParts['name'] . '"';
5613  if (isset($opParts['parameterOrder'])) {
5614  $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"';
5615  }
5616  $portType_xml .= '>';
5617  if (isset($opParts['documentation']) && $opParts['documentation'] != '') {
5618  $portType_xml .= "\n" . ' <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>';
5619  }
5620  $portType_xml .= "\n" . ' <input message="tns:' . $opParts['input']['message'] . '"/>';
5621  $portType_xml .= "\n" . ' <output message="tns:' . $opParts['output']['message'] . '"/>';
5622  $portType_xml .= "\n" . ' </operation>';
5623  }
5624  $portType_xml .= "\n" . '</portType>';
5625  $binding_xml .= "\n" . '</binding>';
5626  }
5627  $xml .= $portType_xml . $binding_xml;
5628  }
5629  // services
5630  $xml .= "\n<service name=\"" . $this->serviceName . '">';
5631  $has_client = isset($_GET['client_id']);
5632  if (count($this->ports) >= 1) {
5633  foreach ($this->ports as $pName => $attrs) {
5634  $xml .= "\n" . ' <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">';
5635  $locations = $attrs['location'];
5636  $locations = is_array($locations) ? $locations : [$locations];
5637  foreach ($locations as $location) {
5638  $address = $location . ($debug || $has_client ? "?" : "")
5639  . ($debug ? 'debug=1' : '') . ($debug && $has_client ? "&amp;" : "")
5640  . ($has_client ? 'client_id=' . $_GET['client_id'] : '');
5641  $xml .= "\n" . ' <soap:address location="' . $address . '"/>';
5642  }
5643  $xml .= "\n" . ' </port>';
5644  }
5645  }
5646 
5647  $xml .= "\n" . '</service>';
5648  return $xml . "\n</definitions>";
5649  }
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:5313
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:819
getPrefixFromNamespace($ns)
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given...
Definition: nusoap.php:870
$_GET['cmd']
Definition: lti.php:26
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:837
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:853
+ 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 6231 of file nusoap.php.

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

6232  {
6233  $xml = '';
6234  if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) {
6235  $this->debug("serialize attributes for XML Schema type $ns:$uqType");
6236  if (is_array($value)) {
6237  $xvalue = $value;
6238  } elseif (is_object($value)) {
6239  $xvalue = get_object_vars($value);
6240  } else {
6241  $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
6242  $xvalue = array();
6243  }
6244  foreach ($typeDef['attrs'] as $aName => $attrs) {
6245  if (isset($xvalue['!' . $aName])) {
6246  $xname = '!' . $aName;
6247  $this->debug("value provided for attribute $aName with key $xname");
6248  } elseif (isset($xvalue[$aName])) {
6249  $xname = $aName;
6250  $this->debug("value provided for attribute $aName with key $xname");
6251  } elseif (isset($attrs['default'])) {
6252  $xname = '!' . $aName;
6253  $xvalue[$xname] = $attrs['default'];
6254  $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName);
6255  } else {
6256  $xname = '';
6257  $this->debug("no value provided for attribute $aName");
6258  }
6259  if ($xname) {
6260  $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
6261  }
6262  }
6263  } else {
6264  $this->debug("no attributes to serialize for XML Schema type $ns:$uqType");
6265  }
6266  if (isset($typeDef['extensionBase'])) {
6267  $ns = $this->getPrefix($typeDef['extensionBase']);
6268  $uqType = $this->getLocalPart($typeDef['extensionBase']);
6269  if ($this->getNamespaceFromPrefix($ns)) {
6270  $ns = $this->getNamespaceFromPrefix($ns);
6271  }
6272  if ($typeDef = $this->getTypeDef($uqType, $ns)) {
6273  $this->debug("serialize attributes for extension base $ns:$uqType");
6274  $xml .= $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
6275  } else {
6276  $this->debug("extension base $ns:$uqType is not a supported type");
6277  }
6278  }
6279  return $xml;
6280  }
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:5313
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:819
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:290
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:837
expandEntities($val)
expands entities, e.g.
Definition: nusoap.php:361
serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType)
serializes the attributes for a complexType
Definition: nusoap.php:6231
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:853
+ 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 6294 of file nusoap.php.

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

6295  {
6296  $xml = '';
6297  if (isset($typeDef['elements']) && is_array($typeDef['elements'])) {
6298  $this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType");
6299  if (is_array($value)) {
6300  $xvalue = $value;
6301  } elseif (is_object($value)) {
6302  $xvalue = get_object_vars($value);
6303  } else {
6304  $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
6305  $xvalue = array();
6306  }
6307  // toggle whether all elements are present - ideally should validate against schema
6308  if (count($typeDef['elements']) != count($xvalue)) {
6309  $optionals = true;
6310  }
6311  foreach ($typeDef['elements'] as $eName => $attrs) {
6312  if (!isset($xvalue[$eName])) {
6313  if (isset($attrs['default'])) {
6314  $xvalue[$eName] = $attrs['default'];
6315  $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName);
6316  }
6317  }
6318  // if user took advantage of a minOccurs=0, then only serialize named parameters
6319  if (isset($optionals)
6320  && (!isset($xvalue[$eName]))
6321  && ((!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
6322  ) {
6323  if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') {
6324  $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']);
6325  }
6326  // do nothing
6327  $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing");
6328  } else {
6329  // get value
6330  if (isset($xvalue[$eName])) {
6331  $v = $xvalue[$eName];
6332  } else {
6333  $v = null;
6334  }
6335  if (isset($attrs['form'])) {
6336  $unqualified = ($attrs['form'] == 'unqualified');
6337  } else {
6338  $unqualified = false;
6339  }
6340  if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') {
6341  $vv = $v;
6342  foreach ($vv as $k => $v) {
6343  if (isset($attrs['type']) || isset($attrs['ref'])) {
6344  // serialize schema-defined type
6345  $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
6346  } else {
6347  // serialize generic type (can this ever really happen?)
6348  $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
6349  $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
6350  }
6351  }
6352  } else {
6353  if (isset($attrs['type']) || isset($attrs['ref'])) {
6354  // serialize schema-defined type
6355  $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
6356  } else {
6357  // serialize generic type (can this ever really happen?)
6358  $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
6359  $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
6360  }
6361  }
6362  }
6363  }
6364  } else {
6365  $this->debug("no elements to serialize for XML Schema type $ns:$uqType");
6366  }
6367  if (isset($typeDef['extensionBase'])) {
6368  $ns = $this->getPrefix($typeDef['extensionBase']);
6369  $uqType = $this->getLocalPart($typeDef['extensionBase']);
6370  if ($this->getNamespaceFromPrefix($ns)) {
6371  $ns = $this->getNamespaceFromPrefix($ns);
6372  }
6373  if ($typeDef = $this->getTypeDef($uqType, $ns)) {
6374  $this->debug("serialize elements for extension base $ns:$uqType");
6375  $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
6376  } else {
6377  $this->debug("extension base $ns:$uqType is not a supported type");
6378  }
6379  }
6380  return $xml;
6381  }
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:5313
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:405
serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false)
serializes the elements for a complexType
Definition: nusoap.php:6294
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:819
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:290
serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
serializes a PHP value according a given type definition
Definition: nusoap.php:5927
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:837
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:853
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:431
+ 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 5849 of file nusoap.php.

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

5850  {
5851  $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion");
5852  $this->appendDebug('parameters=' . $this->varDump($parameters));
5853 
5854  if ($direction != 'input' && $direction != 'output') {
5855  $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
5856  $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
5857  return false;
5858  }
5859  if (!$opData = $this->getOperationData($operation)) {
5860  $this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
5861  $this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
5862  return false;
5863  }
5864  $this->debug('opData:');
5865  $this->appendDebug($this->varDump($opData));
5866 
5867  // Get encoding style for output and set to current
5868  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
5869  if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
5870  $encodingStyle = $opData['output']['encodingStyle'];
5871  $enc_style = $encodingStyle;
5872  }
5873 
5874  // set input params
5875  $xml = '';
5876  if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
5877  $use = $opData[$direction]['use'];
5878  $this->debug("use=$use");
5879  $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
5880  if (is_array($parameters)) {
5881  $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
5882  $this->debug('have ' . $parametersArrayType . ' parameters');
5883  foreach ($opData[$direction]['parts'] as $name => $type) {
5884  $this->debug('serializing part "' . $name . '" of type "' . $type . '"');
5885  // Track encoding style
5886  if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
5887  $encodingStyle = $opData[$direction]['encodingStyle'];
5888  $enc_style = $encodingStyle;
5889  } else {
5890  $enc_style = false;
5891  }
5892  // NOTE: add error handling here
5893  // if serializeType returns false, then catch global error and fault
5894  if ($parametersArrayType == 'arraySimple') {
5895  $p = array_shift($parameters);
5896  $this->debug('calling serializeType w/indexed param');
5897  $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
5898  } elseif (isset($parameters[$name])) {
5899  $this->debug('calling serializeType w/named param');
5900  $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
5901  } else {
5902  // TODO: only send nillable
5903  $this->debug('calling serializeType w/null param');
5904  $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
5905  }
5906  }
5907  } else {
5908  $this->debug('no parameters passed.');
5909  }
5910  }
5911  $this->debug("serializeParameters returning: $xml");
5912  return $xml;
5913  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:303
setError($str)
sets error string
Definition: nusoap.php:393
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:405
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:290
serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
serializes a PHP value according a given type definition
Definition: nusoap.php:5927
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:907
getOperationData($operation, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:5242
$opData
Definition: nusoap.php:4651
+ 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 5754 of file nusoap.php.

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

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

5755  {
5756  $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType");
5757  $this->appendDebug('parameters=' . $this->varDump($parameters));
5758 
5759  if ($direction != 'input' && $direction != 'output') {
5760  $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
5761  $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
5762  return false;
5763  }
5764  if (!$opData = $this->getOperationData($operation, $bindingType)) {
5765  $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
5766  $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
5767  return false;
5768  }
5769  $this->debug('in serializeRPCParameters: opData:');
5770  $this->appendDebug($this->varDump($opData));
5771 
5772  // Get encoding style for output and set to current
5773  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
5774  if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
5775  $encodingStyle = $opData['output']['encodingStyle'];
5776  $enc_style = $encodingStyle;
5777  }
5778 
5779  // set input params
5780  $xml = '';
5781  if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
5782  $parts = &$opData[$direction]['parts'];
5783  $part_count = sizeof($parts);
5784  $style = $opData['style'];
5785  $use = $opData[$direction]['use'];
5786  $this->debug("have $part_count part(s) to serialize using $style/$use");
5787  if (is_array($parameters)) {
5788  $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
5789  $parameter_count = count($parameters);
5790  $this->debug("have $parameter_count parameter(s) provided as $parametersArrayType to serialize");
5791  // check for Microsoft-style wrapped parameters
5792  if ($style == 'document' && $use == 'literal' && $part_count == 1 && isset($parts['parameters'])) {
5793  $this->debug('check whether the caller has wrapped the parameters');
5794  if ((($parametersArrayType == 'arrayStruct' || $parameter_count == 0) && !isset($parameters['parameters'])) || ($direction == 'output' && $parametersArrayType == 'arraySimple' && $parameter_count == 1)) {
5795  $this->debug('check whether caller\'s parameters match the wrapped ones');
5796  if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) {
5797  $this->debug('wrap the parameters for the caller');
5798  $parameters = array('parameters' => $parameters);
5799  $parameter_count = 1;
5800  }
5801  }
5802  }
5803  foreach ($parts as $name => $type) {
5804  $this->debug("serializing part $name of type $type");
5805  // Track encoding style
5806  if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
5807  $encodingStyle = $opData[$direction]['encodingStyle'];
5808  $enc_style = $encodingStyle;
5809  } else {
5810  $enc_style = false;
5811  }
5812  // NOTE: add error handling here
5813  // if serializeType returns false, then catch global error and fault
5814  if ($parametersArrayType == 'arraySimple') {
5815  $p = array_shift($parameters);
5816  $this->debug('calling serializeType w/indexed param');
5817  $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
5818  } elseif (isset($parameters[$name])) {
5819  $this->debug('calling serializeType w/named param');
5820  $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
5821  } else {
5822  // TODO: only send nillable
5823  $this->debug('calling serializeType w/null param');
5824  $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
5825  }
5826  }
5827  } else {
5828  $this->debug('no parameters passed.');
5829  }
5830  }
5831  $this->debug("serializeRPCParameters returning: $xml");
5832  return $xml;
5833  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:303
setError($str)
sets error string
Definition: nusoap.php:393
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:405
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:290
serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
serializes a PHP value according a given type definition
Definition: nusoap.php:5927
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:907
getOperationData($operation, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:5242
$opData
Definition: nusoap.php:4651
parametersMatchWrapped($type, &$parameters)
determine whether a set of parameters are unwrapped when they are expect to be wrapped, Microsoft-style.
Definition: nusoap.php:5660
+ 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 5927 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(), nusoap_base\serialize_val(), nusoap_base\setError(), and nusoap_base\varDump().

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

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

Referenced by nusoap_client\loadWSDL().

5187  {
5188  $this->debug("setCredentials username=$username authtype=$authtype certRequest=");
5189  $this->appendDebug($this->varDump($certRequest));
5190  $this->username = $username;
5191  $this->password = $password;
5192  $this->authtype = $authtype;
5193  $this->certRequest = $certRequest;
5194  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:303
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:290
$password
Definition: nusoap.php:4673
$authtype
Definition: nusoap.php:4674
$username
Definition: nusoap.php:4672
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:907
$certRequest
Definition: nusoap.php:4675
+ 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 4922 of file nusoap.php.

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

4923  {
4924  if ($this->status == 'schema') {
4925  $this->currentSchema->schemaStartElement($parser, $name, $attrs);
4926  $this->appendDebug($this->currentSchema->getDebug());
4927  $this->currentSchema->clearDebug();
4928  } elseif (preg_match('/schema$/', $name)) {
4929  $this->debug('Parsing WSDL schema');
4930  // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")");
4931  $this->status = 'schema';
4932  $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces);
4933  $this->currentSchema->schemaStartElement($parser, $name, $attrs);
4934  $this->appendDebug($this->currentSchema->getDebug());
4935  $this->currentSchema->clearDebug();
4936  } else {
4937  // position in the total number of elements, starting from 0
4938  $pos = $this->position++;
4939  $depth = $this->depth++;
4940  // set self as current value for this depth
4941  $this->depth_array[$depth] = $pos;
4942  $this->message[$pos] = array('cdata' => '');
4943  // process attributes
4944  if (count($attrs) > 0) {
4945  // register namespace declarations
4946  foreach ($attrs as $k => $v) {
4947  if (preg_match('/^xmlns/', $k)) {
4948  if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
4949  $this->namespaces[$ns_prefix] = $v;
4950  } else {
4951  $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
4952  }
4953  if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
4954  $this->XMLSchemaVersion = $v;
4955  $this->namespaces['xsi'] = $v . '-instance';
4956  }
4957  }
4958  }
4959  // expand each attribute prefix to its namespace
4960  foreach ($attrs as $k => $v) {
4961  $k = strpos($k, ':') ? $this->expandQname($k) : $k;
4962  if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') {
4963  $v = strpos($v, ':') ? $this->expandQname($v) : $v;
4964  }
4965  $eAttrs[$k] = $v;
4966  }
4967  $attrs = $eAttrs;
4968  } else {
4969  $attrs = array();
4970  }
4971  // get element prefix, namespace and name
4972  if (preg_match('/:/', $name)) {
4973  // get ns prefix
4974  $prefix = substr($name, 0, strpos($name, ':'));
4975  // get ns
4976  $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : '';
4977  // get unqualified name
4978  $name = substr(strstr($name, ':'), 1);
4979  }
4980  // process attributes, expanding any prefixes to namespaces
4981  // find status, register data
4982  switch ($this->status) {
4983  case 'message':
4984  if ($name == 'part') {
4985  if (isset($attrs['type'])) {
4986  $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs));
4987  $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type'];
4988  }
4989  if (isset($attrs['element'])) {
4990  $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs));
4991  $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^';
4992  }
4993  }
4994  break;
4995  case 'portType':
4996  switch ($name) {
4997  case 'operation':
4998  $this->currentPortOperation = $attrs['name'];
4999  $this->debug("portType $this->currentPortType operation: $this->currentPortOperation");
5000  if (isset($attrs['parameterOrder'])) {
5001  $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder'];
5002  }
5003  break;
5004  case 'documentation':
5005  $this->documentation = true;
5006  break;
5007  // merge input/output data
5008  default:
5009  $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : '';
5010  $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m;
5011  break;
5012  }
5013  break;
5014  case 'binding':
5015  switch ($name) {
5016  case 'binding':
5017  // get ns prefix
5018  if (isset($attrs['style'])) {
5019  $this->bindings[$this->currentBinding]['prefix'] = $prefix;
5020  }
5021  $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs);
5022  break;
5023  case 'header':
5024  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs;
5025  break;
5026  case 'operation':
5027  if (isset($attrs['soapAction'])) {
5028  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction'];
5029  }
5030  if (isset($attrs['style'])) {
5031  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style'];
5032  }
5033  if (isset($attrs['name'])) {
5034  $this->currentOperation = $attrs['name'];
5035  $this->debug("current binding operation: $this->currentOperation");
5036  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name'];
5037  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding;
5038  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : '';
5039  }
5040  break;
5041  case 'input':
5042  $this->opStatus = 'input';
5043  break;
5044  case 'output':
5045  $this->opStatus = 'output';
5046  break;
5047  case 'body':
5048  if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) {
5049  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs);
5050  } else {
5051  $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs;
5052  }
5053  break;
5054  }
5055  break;
5056  case 'service':
5057  switch ($name) {
5058  case 'port':
5059  $this->currentPort = $attrs['name'];
5060  $this->debug('current port: ' . $this->currentPort);
5061  $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']);
5062 
5063  break;
5064  case 'address':
5065  $this->ports[$this->currentPort]['location'] = $attrs['location'];
5066  $this->ports[$this->currentPort]['bindingType'] = $namespace;
5067  $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace;
5068  $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location'];
5069  break;
5070  }
5071  break;
5072  }
5073  // set status
5074  switch ($name) {
5075  case 'import':
5076  if (isset($attrs['location'])) {
5077  $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false);
5078  $this->debug('parsing import ' . $attrs['namespace'] . ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]) . ')');
5079  } else {
5080  $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
5081  if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
5082  $this->namespaces['ns' . (count($this->namespaces)+1)] = $attrs['namespace'];
5083  }
5084  $this->debug('parsing import ' . $attrs['namespace'] . ' - [no location] (' . count($this->import[$attrs['namespace']]) . ')');
5085  }
5086  break;
5087  //wait for schema
5088  //case 'types':
5089  // $this->status = 'schema';
5090  // break;
5091  case 'message':
5092  $this->status = 'message';
5093  $this->messages[$attrs['name']] = array();
5094  $this->currentMessage = $attrs['name'];
5095  break;
5096  case 'portType':
5097  $this->status = 'portType';
5098  $this->portTypes[$attrs['name']] = array();
5099  $this->currentPortType = $attrs['name'];
5100  break;
5101  case "binding":
5102  if (isset($attrs['name'])) {
5103  // get binding name
5104  if (strpos($attrs['name'], ':')) {
5105  $this->currentBinding = $this->getLocalPart($attrs['name']);
5106  } else {
5107  $this->currentBinding = $attrs['name'];
5108  }
5109  $this->status = 'binding';
5110  $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']);
5111  $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']);
5112  }
5113  break;
5114  case 'service':
5115  $this->serviceName = $attrs['name'];
5116  $this->status = 'service';
5117  $this->debug('current service: ' . $this->serviceName);
5118  break;
5119  case 'definitions':
5120  foreach ($attrs as $name => $value) {
5121  $this->wsdl_info[$name] = $value;
5122  }
5123  break;
5124  }
5125  }
5126  }
if($err=$client->getError()) $namespace
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:303
$currentBinding
Definition: nusoap.php:4648
$depth
Definition: nusoap.php:4660
$currentPortType
Definition: nusoap.php:4646
$parser
Definition: nusoap.php:4658
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:819
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:290
$currentPort
Definition: nusoap.php:4650
getPrefixFromNamespace($ns)
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given...
Definition: nusoap.php:870
expandQname($qname)
expands (changes prefix to namespace) a qualified name
Definition: nusoap.php:793
parses an XML Schema, allows access to it&#39;s data, other utility methods.
Definition: nusoap.php:1125
$currentPortOperation
Definition: nusoap.php:4635
$opStatus
Definition: nusoap.php:4634
$currentOperation
Definition: nusoap.php:4644
$currentMessage
Definition: nusoap.php:4643
+ Here is the call graph for this function:

◆ webDescription()

wsdl::webDescription ( )

prints html description of services

private

Definition at line 5370 of file nusoap.php.

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

Referenced by nusoap_server\service().

5371  {
5372  global $HTTP_SERVER_VARS;
5373 
5374  if (isset($_SERVER)) {
5375  $PHP_SELF = $_SERVER['PHP_SELF'];
5376  } elseif (isset($HTTP_SERVER_VARS)) {
5377  $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
5378  } else {
5379  $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
5380  }
5381  // begin-patch: https://mantis.ilias.de/view.php?id=28866
5382  $PHP_SELF = htmlspecialchars($PHP_SELF, ENT_QUOTES | ENT_HTML5, 'UTF-8');
5383  // end-patch
5384 
5385  $b = '
5386  <html><head><title>NuSOAP: ' . $this->serviceName . '</title>
5387  <style type="text/css">
5388  body { font-family: arial; color: #000000; background-color: #ffffff; margin: 0px 0px 0px 0px; }
5389  p { font-family: arial; color: #000000; margin-top: 0px; margin-bottom: 12px; }
5390  pre { background-color: silver; padding: 5px; font-family: Courier New; font-size: x-small; color: #000000;}
5391  ul { margin-top: 10px; margin-left: 20px; }
5392  li { list-style-type: none; margin-top: 10px; color: #000000; }
5393  .content{
5394  margin-left: 0px; padding-bottom: 2em; }
5395  .nav {
5396  padding-top: 10px; padding-bottom: 10px; padding-left: 15px; font-size: .70em;
5397  margin-top: 10px; margin-left: 0px; color: #000000;
5398  background-color: #ccccff; width: 20%; margin-left: 20px; margin-top: 20px; }
5399  .title {
5400  font-family: arial; font-size: 26px; color: #ffffff;
5401  background-color: #999999; width: 105%; margin-left: 0px;
5402  padding-top: 10px; padding-bottom: 10px; padding-left: 15px;}
5403  .hidden {
5404  position: absolute; visibility: hidden; z-index: 200; left: 250px; top: 100px;
5405  font-family: arial; overflow: hidden; width: 600;
5406  padding: 20px; font-size: 10px; background-color: #999999;
5407  layer-background-color:#FFFFFF; }
5408  a,a:active { color: charcoal; font-weight: bold; }
5409  a:visited { color: #666666; font-weight: bold; }
5410  a:hover { color: cc3300; font-weight: bold; }
5411  </style>
5412  <script language="JavaScript" type="text/javascript">
5413  <!--
5414  // POP-UP CAPTIONS...
5415  function lib_bwcheck(){ //Browsercheck (needed)
5416  this.ver=navigator.appVersion
5417  this.agent=navigator.userAgent
5418  this.dom=document.getElementById?1:0
5419  this.opera5=this.agent.indexOf("Opera 5")>-1
5420  this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
5421  this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
5422  this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
5423  this.ie=this.ie4||this.ie5||this.ie6
5424  this.mac=this.agent.indexOf("Mac")>-1
5425  this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
5426  this.ns4=(document.layers && !this.dom)?1:0;
5427  this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
5428  return this
5429  }
5430  var bw = new lib_bwcheck()
5431  //Makes crossbrowser object.
5432  function makeObj(obj){
5433  this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
5434  if(!this.evnt) return false
5435  this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;
5436  this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;
5437  this.writeIt=b_writeIt;
5438  return this
5439  }
5440  // A unit of measure that will be added when setting the position of a layer.
5441  //var px = bw.ns4||window.opera?"":"px";
5442  function b_writeIt(text){
5443  if (bw.ns4){this.wref.write(text);this.wref.close()}
5444  else this.wref.innerHTML = text
5445  }
5446  //Shows the messages
5447  var oDesc;
5448  function popup(divid){
5449  if(oDesc = new makeObj(divid)){
5450  oDesc.css.visibility = "visible"
5451  }
5452  }
5453  function popout(){ // Hides message
5454  if(oDesc) oDesc.css.visibility = "hidden"
5455  }
5456  //-->
5457  </script>
5458  </head>
5459  <body>
5460  <div class=content>
5461  <br><br>
5462  <div class=title>' . $this->serviceName . '</div>
5463  <div class=nav>
5464  <p>View the <a href="' . $PHP_SELF . '?wsdl">WSDL</a> for the service.
5465  Click on an operation name to view it&apos;s details.</p>
5466  <ul>';
5467  foreach ($this->getOperations() as $op => $data) {
5468  // begin-patch: https://mantis.ilias.de/view.php?id=28866
5469  if (isset($data['endpoint'])) {
5470  $data['endpoint'] = htmlspecialchars($data['endpoint'], ENT_QUOTES | ENT_HTML5, 'UTF-8');
5471  }
5472  // end-patch
5473  $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>";
5474  // create hidden div
5475  $b .= "<div id='$op' class='hidden'>
5476  <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>";
5477  foreach ($data as $donnie => $marie) { // loop through opdata
5478  if ($donnie == 'input' || $donnie == 'output') { // show input/output data
5479  $b .= "<font color='white'>" . ucfirst($donnie) . ':</font><br>';
5480  foreach ($marie as $captain => $tenille) { // loop through data
5481  if ($captain == 'parts') { // loop thru parts
5482  $b .= "&nbsp;&nbsp;$captain:<br>";
5483  //if(is_array($tenille)){
5484  foreach ($tenille as $joanie => $chachi) {
5485  $b .= "&nbsp;&nbsp;&nbsp;&nbsp;$joanie: $chachi<br>";
5486  }
5487  //}
5488  } else {
5489  $b .= "&nbsp;&nbsp;$captain: $tenille<br>";
5490  }
5491  }
5492  } else {
5493  $b .= "<font color='white'>" . ucfirst($donnie) . ":</font> $marie<br>";
5494  }
5495  }
5496  $b .= '</div>';
5497  }
5498  $b .= '
5499  <ul>
5500  </div>
5501  </div></body></html>';
5502  return $b;
5503  }
setError($str)
sets error string
Definition: nusoap.php:393
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
getOperations($bindingType='soap')
returns an assoc array of operation names => operation data
Definition: nusoap.php:5210
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $authtype

wsdl::$authtype = ''

Definition at line 4674 of file nusoap.php.

◆ $bindings

wsdl::$bindings = array()

Definition at line 4647 of file nusoap.php.

◆ $certRequest

wsdl::$certRequest = array()

Definition at line 4675 of file nusoap.php.

◆ $complexTypes

wsdl::$complexTypes = array()

Definition at line 4641 of file nusoap.php.

◆ $curl_options

wsdl::$curl_options = array()

Definition at line 4669 of file nusoap.php.

◆ $currentBinding

wsdl::$currentBinding

Definition at line 4648 of file nusoap.php.

◆ $currentMessage

wsdl::$currentMessage

Definition at line 4643 of file nusoap.php.

◆ $currentOperation

wsdl::$currentOperation

Definition at line 4644 of file nusoap.php.

◆ $currentPort

wsdl::$currentPort

Definition at line 4650 of file nusoap.php.

◆ $currentPortOperation

wsdl::$currentPortOperation

Definition at line 4635 of file nusoap.php.

◆ $currentPortType

wsdl::$currentPortType

Definition at line 4646 of file nusoap.php.

◆ $currentSchema

wsdl::$currentSchema

Definition at line 4639 of file nusoap.php.

◆ $depth

wsdl::$depth = 0

Definition at line 4660 of file nusoap.php.

◆ $depth_array

wsdl::$depth_array = array()

Definition at line 4661 of file nusoap.php.

◆ $documentation

wsdl::$documentation = false

Definition at line 4653 of file nusoap.php.

◆ $endpoint

wsdl::$endpoint = ''

Definition at line 4654 of file nusoap.php.

◆ $import

wsdl::$import = array()

Definition at line 4656 of file nusoap.php.

◆ $message

wsdl::$message = array()

Definition at line 4640 of file nusoap.php.

◆ $messages

wsdl::$messages = array()

Definition at line 4642 of file nusoap.php.

◆ $opData

wsdl::$opData = array()

Definition at line 4651 of file nusoap.php.

◆ $opStatus

wsdl::$opStatus

Definition at line 4634 of file nusoap.php.

◆ $parser

wsdl::$parser

Definition at line 4658 of file nusoap.php.

◆ $password

wsdl::$password = ''

Definition at line 4673 of file nusoap.php.

◆ $ports

wsdl::$ports = array()

Definition at line 4649 of file nusoap.php.

◆ $portTypes

wsdl::$portTypes = array()

Definition at line 4645 of file nusoap.php.

◆ $position

wsdl::$position = 0

Definition at line 4659 of file nusoap.php.

◆ $proxyhost

wsdl::$proxyhost = ''

Definition at line 4663 of file nusoap.php.

◆ $proxypassword

wsdl::$proxypassword = ''

Definition at line 4666 of file nusoap.php.

◆ $proxyport

wsdl::$proxyport = ''

Definition at line 4664 of file nusoap.php.

◆ $proxyusername

wsdl::$proxyusername = ''

Definition at line 4665 of file nusoap.php.

◆ $response_timeout

wsdl::$response_timeout = 30

Definition at line 4668 of file nusoap.php.

◆ $schemas

wsdl::$schemas = array()

Definition at line 4638 of file nusoap.php.

◆ $serviceName

wsdl::$serviceName

Definition at line 4633 of file nusoap.php.

◆ $status

wsdl::$status = ''

Definition at line 4652 of file nusoap.php.

◆ $timeout

wsdl::$timeout = 0

Definition at line 4667 of file nusoap.php.

◆ $use_curl

wsdl::$use_curl = false

Definition at line 4670 of file nusoap.php.

◆ $username

wsdl::$username = ''

Definition at line 4672 of file nusoap.php.

◆ $wsdl

wsdl::$wsdl

Definition at line 4636 of file nusoap.php.


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