ILIAS  release_8 Revision v8.23
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

 $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 4617 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 4675 of file nusoap.php.

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

4676  {
4678  $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
4679  $this->proxyhost = $proxyhost;
4680  $this->proxyport = $proxyport;
4681  $this->proxyusername = $proxyusername;
4682  $this->proxypassword = $proxypassword;
4683  $this->timeout = $timeout;
4684  $this->response_timeout = $response_timeout;
4685  if (is_array($curl_options)) {
4686  $this->curl_options = $curl_options;
4687  }
4688  $this->use_curl = $use_curl;
4689  $this->fetchWSDL($wsdl);
4690  }
$proxyhost
Definition: nusoap.php:4647
$wsdl
Definition: nusoap.php:4620
$use_curl
Definition: nusoap.php:4654
$proxyusername
Definition: nusoap.php:4649
$curl_options
Definition: nusoap.php:4653
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
$proxyport
Definition: nusoap.php:4648
$response_timeout
Definition: nusoap.php:4652
$timeout
Definition: nusoap.php:4651
__construct(Container $dic, ilPlugin $plugin)
fetchWSDL($wsdl)
fetches the WSDL document and parses it
Definition: nusoap.php:4697
$proxypassword
Definition: nusoap.php:4650
+ 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 6377 of file nusoap.php.

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

6378  {
6379  if (count($elements) > 0) {
6380  $eElements = array();
6381  foreach ($elements as $n => $e) {
6382  // expand each element
6383  $ee = array();
6384  foreach ($e as $k => $v) {
6385  $k = strpos($k, ':') ? $this->expandQname($k) : $k;
6386  $v = strpos($v, ':') ? $this->expandQname($v) : $v;
6387  $ee[$k] = $v;
6388  }
6389  $eElements[$n] = $ee;
6390  }
6391  $elements = $eElements;
6392  }
6393 
6394  if (count($attrs) > 0) {
6395  foreach ($attrs as $n => $a) {
6396  // expand each attribute
6397  foreach ($a as $k => $v) {
6398  $k = strpos($k, ':') ? $this->expandQname($k) : $k;
6399  $v = strpos($v, ':') ? $this->expandQname($v) : $v;
6400  $aa[$k] = $v;
6401  }
6402  $eAttrs[$n] = $aa;
6403  }
6404  $attrs = $eAttrs;
6405  }
6406 
6407  $restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase;
6408  $arrayType = strpos($arrayType, ':') ? $this->expandQname($arrayType) : $arrayType;
6409 
6410  $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6411  $this->schemas[$typens][0]->addComplexType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs, $arrayType);
6412  }
if($format !==null) $name
Definition: metadata.php:247
expandQname($qname)
expands (changes prefix to namespace) a qualified name
Definition: nusoap.php:795
$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 6440 of file nusoap.php.

6441  {
6442  $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6443  $this->schemas[$typens][0]->addElement($attrs);
6444  }

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

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

Referenced by nusoap_server\register().

6461  {
6462  if ($use == 'encoded' && $encodingStyle == '') {
6463  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
6464  }
6465 
6466  if ($style == 'document') {
6467  $elements = array();
6468  foreach ($in as $n => $t) {
6469  $elements[$n] = array('name' => $n, 'type' => $t);
6470  }
6471  $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements);
6472  $this->addElement(array('name' => $name, 'type' => $name . 'RequestType'));
6473  $in = array('parameters' => 'tns:' . $name . '^');
6474 
6475  $elements = array();
6476  foreach ($out as $n => $t) {
6477  $elements[$n] = array('name' => $n, 'type' => $t);
6478  }
6479  $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements);
6480  $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified'));
6481  $out = array('parameters' => 'tns:' . $name . 'Response' . '^');
6482  }
6483 
6484  // get binding
6485  $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] =
6486  array(
6487  'name' => $name,
6488  'binding' => $this->serviceName . 'Binding',
6489  'endpoint' => $this->endpoint,
6490  'soapAction' => $soapaction,
6491  'style' => $style,
6492  'input' => array(
6493  'use' => $use,
6494  'namespace' => $namespace,
6495  'encodingStyle' => $encodingStyle,
6496  'message' => $name . 'Request',
6497  'parts' => $in),
6498  'output' => array(
6499  'use' => $use,
6500  'namespace' => $namespace,
6501  'encodingStyle' => $encodingStyle,
6502  'message' => $name . 'Response',
6503  'parts' => $out),
6504  'namespace' => $namespace,
6505  'transport' => 'http://schemas.xmlsoap.org/soap/http',
6506  'documentation' => $documentation);
6507  // add portTypes
6508  // add messages
6509  if ($in) {
6510  foreach ($in as $pName => $pType) {
6511  if (strpos($pType, ':')) {
6512  $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)) . ":" . $this->getLocalPart($pType);
6513  }
6514  $this->messages[$name . 'Request'][$pName] = $pType;
6515  }
6516  } else {
6517  $this->messages[$name . 'Request']= '0';
6518  }
6519  if ($out) {
6520  foreach ($out as $pName => $pType) {
6521  if (strpos($pType, ':')) {
6522  $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)) . ":" . $this->getLocalPart($pType);
6523  }
6524  $this->messages[$name . 'Response'][$pName] = $pType;
6525  }
6526  } else {
6527  $this->messages[$name . 'Response']= '0';
6528  }
6529  return true;
6530  }
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:6377
$documentation
Definition: nusoap.php:4637
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:821
addElement($attrs)
adds an element to the WSDL types
Definition: nusoap.php:6440
if($format !==null) $name
Definition: metadata.php:247
$out
Definition: buildRTE.php:24
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:839
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:855
+ 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 6425 of file nusoap.php.

References $name, and nusoap_base\expandQname().

6426  {
6427  $restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase;
6428 
6429  $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6430  $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration);
6431  }
if($format !==null) $name
Definition: metadata.php:247
expandQname($qname)
expands (changes prefix to namespace) a qualified name
Definition: nusoap.php:795
+ 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 5150 of file nusoap.php.

References $data.

5151  {
5152  $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
5153  if (isset($this->message[$pos]['cdata'])) {
5154  $this->message[$pos]['cdata'] .= $data;
5155  }
5156  if ($this->documentation) {
5157  $this->documentation .= $data;
5158  }
5159  }
$depth
Definition: nusoap.php:4644

◆ end_element()

wsdl::end_element (   $parser,
  $name 
)

end-element handler

Parameters
string$parserXML parser object
string$nameelement name private

Definition at line 5119 of file nusoap.php.

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

5120  {
5121  // unset schema status
5122  if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) {
5123  $this->status = "";
5124  $this->appendDebug($this->currentSchema->getDebug());
5125  $this->currentSchema->clearDebug();
5126  $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
5127  $this->debug('Parsing WSDL schema done');
5128  }
5129  if ($this->status == 'schema') {
5130  $this->currentSchema->schemaEndElement($parser, $name);
5131  } else {
5132  // bring depth down a notch
5133  $this->depth--;
5134  }
5135  // end documentation
5136  if ($this->documentation) {
5137  //TODO: track the node to which documentation should be assigned; it can be a part, message, etc.
5138  //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation;
5139  $this->documentation = false;
5140  }
5141  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:305
$currentSchema
Definition: nusoap.php:4623
$parser
Definition: nusoap.php:4642
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
if($format !==null) $name
Definition: metadata.php:247
+ Here is the call graph for this function:

◆ fetchWSDL()

wsdl::fetchWSDL (   $wsdl)

fetches the WSDL document and parses it

public

Definition at line 4697 of file nusoap.php.

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

Referenced by nusoap_client\loadWSDL().

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

◆ getBindingData()

wsdl::getBindingData (   $binding)

Definition at line 5180 of file nusoap.php.

5181  {
5182  if (is_array($this->bindings[$binding])) {
5183  return $this->bindings[$binding];
5184  }
5185  }

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

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

5227  {
5228  if ($bindingType == 'soap') {
5229  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
5230  } elseif ($bindingType == 'soap12') {
5231  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
5232  }
5233  // loop thru ports
5234  foreach ($this->ports as $port => $portData) {
5235  // binding type of port matches parameter
5236  if ($portData['bindingType'] == $bindingType) {
5237  // get binding
5238  //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
5239  foreach (array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) {
5240  // note that we could/should also check the namespace here
5241  if ($operation == $bOperation) {
5242  $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
5243  return $opData;
5244  }
5245  }
5246  }
5247  }
5248  }
$opData
Definition: nusoap.php:4635
+ 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 5258 of file nusoap.php.

Referenced by nusoap_server\invoke_method().

5259  {
5260  if ($bindingType == 'soap') {
5261  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
5262  } elseif ($bindingType == 'soap12') {
5263  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
5264  }
5265  // loop thru ports
5266  foreach ($this->ports as $port => $portData) {
5267  // binding type of port matches parameter
5268  if ($portData['bindingType'] == $bindingType) {
5269  // loop through operations for the binding
5270  foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
5271  if ($opData['soapAction'] == $soapAction) {
5272  return $opData;
5273  }
5274  }
5275  }
5276  }
5277  }
$opData
Definition: nusoap.php:4635
+ 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 5194 of file nusoap.php.

Referenced by nusoap_client\checkWSDL().

5195  {
5196  $ops = array();
5197  if ($bindingType == 'soap') {
5198  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
5199  } elseif ($bindingType == 'soap12') {
5200  $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
5201  }
5202  // loop thru ports
5203  foreach ($this->ports as $port => $portData) {
5204  // binding type of port matches parameter
5205  if ($portData['bindingType'] == $bindingType) {
5206  //$this->debug("getOperations for port $port");
5207  //$this->debug("port data: " . $this->varDump($portData));
5208  //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ]));
5209  // merge bindings
5210  if (isset($this->bindings[ $portData['binding'] ]['operations'])) {
5211  $ops = array_merge($ops, $this->bindings[ $portData['binding'] ]['operations']);
5212  }
5213  }
5214  }
5215  return $ops;
5216  }
+ 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 5297 of file nusoap.php.

References $i, $type, nusoap_base\debug(), and nusoap_base\varDump().

5298  {
5299  $this->debug("in getTypeDef: type=$type, ns=$ns");
5300  if ((! $ns) && isset($this->namespaces['tns'])) {
5301  $ns = $this->namespaces['tns'];
5302  $this->debug("in getTypeDef: type namespace forced to $ns");
5303  }
5304  if (!isset($this->schemas[$ns])) {
5305  foreach ($this->schemas as $ns0 => $schema0) {
5306  if (strcasecmp($ns, $ns0) == 0) {
5307  $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0");
5308  $ns = $ns0;
5309  break;
5310  }
5311  }
5312  }
5313  if (isset($this->schemas[$ns])) {
5314  $this->debug("in getTypeDef: have schema for namespace $ns");
5315  for ($i = 0; $i < count($this->schemas[$ns]); $i++) {
5316  $xs = &$this->schemas[$ns][$i];
5317  $t = $xs->getTypeDef($type);
5318  //$this->appendDebug($xs->getDebug());
5319  //$xs->clearDebug();
5320  if ($t) {
5321  if (!isset($t['phpType'])) {
5322  // get info for type to tack onto the element
5323  $uqType = substr($t['type'], strrpos($t['type'], ':') + 1);
5324  $ns = substr($t['type'], 0, strrpos($t['type'], ':'));
5325  $etype = $this->getTypeDef($uqType, $ns);
5326  if ($etype) {
5327  $this->debug("found type for [element] $type:");
5328  $this->debug($this->varDump($etype));
5329  if (isset($etype['phpType'])) {
5330  $t['phpType'] = $etype['phpType'];
5331  }
5332  if (isset($etype['elements'])) {
5333  $t['elements'] = $etype['elements'];
5334  }
5335  if (isset($etype['attrs'])) {
5336  $t['attrs'] = $etype['attrs'];
5337  }
5338  }
5339  }
5340  return $t;
5341  }
5342  }
5343  } else {
5344  $this->debug("in getTypeDef: do not have schema for namespace $ns");
5345  }
5346  return false;
5347  }
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:5297
$type
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:909
$i
Definition: metadata.php:41
+ 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 5640 of file nusoap.php.

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

5641  {
5642  $this->debug("in parametersMatchWrapped type=$type, parameters=");
5643  $this->appendDebug($this->varDump($parameters));
5644 
5645  // split type into namespace:unqualified-type
5646  if (strpos($type, ':')) {
5647  $uqType = substr($type, strrpos($type, ':') + 1);
5648  $ns = substr($type, 0, strrpos($type, ':'));
5649  $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns");
5650  if ($this->getNamespaceFromPrefix($ns)) {
5651  $ns = $this->getNamespaceFromPrefix($ns);
5652  $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns");
5653  }
5654  } else {
5655  // TODO: should the type be compared to types in XSD, and the namespace
5656  // set to XSD if the type matches?
5657  $this->debug("in parametersMatchWrapped: No namespace for type $type");
5658  $ns = '';
5659  $uqType = $type;
5660  }
5661 
5662  // get the type information
5663  if (!$typeDef = $this->getTypeDef($uqType, $ns)) {
5664  $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type.");
5665  return false;
5666  }
5667  $this->debug("in parametersMatchWrapped: found typeDef=");
5668  $this->appendDebug($this->varDump($typeDef));
5669  if (substr($uqType, -1) == '^') {
5670  $uqType = substr($uqType, 0, -1);
5671  }
5672  $phpType = $typeDef['phpType'];
5673  $arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '');
5674  $this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType");
5675 
5676  // we expect a complexType or element of complexType
5677  if ($phpType != 'struct') {
5678  $this->debug("in parametersMatchWrapped: not a struct");
5679  return false;
5680  }
5681 
5682  // see whether the parameter names match the elements
5683  if (isset($typeDef['elements']) && is_array($typeDef['elements'])) {
5684  $elements = 0;
5685  $matches = 0;
5686  $change = false;
5687  if ($this->isArraySimpleOrStruct($parameters) == 'arraySimple' && count($parameters) == count($typeDef['elements'])) {
5688  $this->debug("in parametersMatchWrapped: (wrapped return value kludge) correct number of elements in simple array, so change array and wrap");
5689  $change = true;
5690  }
5691  foreach ($typeDef['elements'] as $name => $attrs) {
5692  if ($change) {
5693  $this->debug("in parametersMatchWrapped: change parameter $element to name $name");
5694  $parameters[$name] = $parameters[$elements];
5695  unset($parameters[$elements]);
5696  $matches++;
5697  } elseif (isset($parameters[$name])) {
5698  $this->debug("in parametersMatchWrapped: have parameter named $name");
5699  $matches++;
5700  } else {
5701  $this->debug("in parametersMatchWrapped: do not have parameter named $name");
5702  }
5703  $elements++;
5704  }
5705 
5706  $this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped parameter names");
5707  if ($matches == 0) {
5708  return false;
5709  }
5710  return true;
5711  }
5712 
5713  // since there are no elements for the type, if the user passed no
5714  // parameters, the parameters match wrapped.
5715  $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType");
5716  return count($parameters) == 0;
5717  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:305
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:5297
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:407
$type
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
if($format !==null) $name
Definition: metadata.php:247
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:909
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:855
+ 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 4801 of file nusoap.php.

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

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

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

Referenced by nusoap_server\service().

5497  {
5498  $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>';
5499  $xml .= "\n<definitions";
5500  foreach ($this->namespaces as $k => $v) {
5501  $xml .= " xmlns:$k=\"$v\"";
5502  }
5503  // 10.9.02 - add poulter fix for wsdl and tns declarations
5504  if (isset($this->namespaces['wsdl'])) {
5505  $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
5506  }
5507  if (isset($this->namespaces['tns'])) {
5508  $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
5509  }
5510  $xml .= '>';
5511  // imports
5512  if (sizeof($this->import) > 0) {
5513  foreach ($this->import as $ns => $list) {
5514  foreach ($list as $ii) {
5515  if ($ii['location'] != '') {
5516  $xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />';
5517  } else {
5518  $xml .= '<import namespace="' . $ns . '" />';
5519  }
5520  }
5521  }
5522  }
5523  // types
5524  if (count($this->schemas)>=1) {
5525  $xml .= "\n<types>\n";
5526  foreach ($this->schemas as $ns => $list) {
5527  foreach ($list as $xs) {
5528  $xml .= $xs->serializeSchema();
5529  }
5530  }
5531  $xml .= '</types>';
5532  }
5533  // messages
5534  if (count($this->messages) >= 1) {
5535  foreach ($this->messages as $msgName => $msgParts) {
5536  $xml .= "\n<message name=\"" . $msgName . '">';
5537  if (is_array($msgParts)) {
5538  foreach ($msgParts as $partName => $partType) {
5539  // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>';
5540  if (strpos($partType, ':')) {
5541  $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType));
5542  } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) {
5543  // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>';
5544  $typePrefix = 'xsd';
5545  } else {
5546  foreach ($this->typemap as $ns => $types) {
5547  if (isset($types[$partType])) {
5548  $typePrefix = $this->getPrefixFromNamespace($ns);
5549  }
5550  }
5551  if (!isset($typePrefix)) {
5552  die("$partType has no namespace!");
5553  }
5554  }
5555  $ns = $this->getNamespaceFromPrefix($typePrefix);
5556  $localPart = $this->getLocalPart($partType);
5557  $typeDef = $this->getTypeDef($localPart, $ns);
5558  if (($typeDef['typeClass'] ?? '') == 'element') {
5559  $elementortype = 'element';
5560  if (substr($localPart, -1) == '^') {
5561  $localPart = substr($localPart, 0, -1);
5562  }
5563  } else {
5564  $elementortype = 'type';
5565  }
5566  $xml .= "\n" . ' <part name="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $localPart . '" />';
5567  }
5568  }
5569  $xml .= '</message>';
5570  }
5571  }
5572  // bindings & porttypes
5573  if (count($this->bindings) >= 1) {
5574  $binding_xml = '';
5575  $portType_xml = '';
5576  foreach ($this->bindings as $bindingName => $attrs) {
5577  $binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">';
5578  $binding_xml .= "\n" . ' <soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>';
5579  $portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">';
5580  foreach ($attrs['operations'] as $opName => $opParts) {
5581  $binding_xml .= "\n" . ' <operation name="' . $opName . '">';
5582  $binding_xml .= "\n" . ' <soap:operation soapAction="' . $opParts['soapAction'] . '" style="' . $opParts['style'] . '"/>';
5583  if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') {
5584  $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"';
5585  } else {
5586  $enc_style = '';
5587  }
5588  $binding_xml .= "\n" . ' <input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>';
5589  if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') {
5590  $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"';
5591  } else {
5592  $enc_style = '';
5593  }
5594  $binding_xml .= "\n" . ' <output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>';
5595  $binding_xml .= "\n" . ' </operation>';
5596  $portType_xml .= "\n" . ' <operation name="' . $opParts['name'] . '"';
5597  if (isset($opParts['parameterOrder'])) {
5598  $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"';
5599  }
5600  $portType_xml .= '>';
5601  if (isset($opParts['documentation']) && $opParts['documentation'] != '') {
5602  $portType_xml .= "\n" . ' <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>';
5603  }
5604  $portType_xml .= "\n" . ' <input message="tns:' . $opParts['input']['message'] . '"/>';
5605  $portType_xml .= "\n" . ' <output message="tns:' . $opParts['output']['message'] . '"/>';
5606  $portType_xml .= "\n" . ' </operation>';
5607  }
5608  $portType_xml .= "\n" . '</portType>';
5609  $binding_xml .= "\n" . '</binding>';
5610  }
5611  $xml .= $portType_xml . $binding_xml;
5612  }
5613  // services
5614  $xml .= "\n<service name=\"" . $this->serviceName . '">';
5615  $has_client = isset($_GET['client_id']);
5616  if (count($this->ports) >= 1) {
5617  foreach ($this->ports as $pName => $attrs) {
5618  $xml .= "\n" . ' <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">';
5619  $address = $attrs['location'] . ($debug || $has_client ? "?" : "")
5620  . ($debug ? 'debug=1' : '') . ($debug && $has_client ? "&amp;" : "")
5621  . ($has_client ? 'client_id=' . $_GET['client_id'] : '');
5622  $xml .= "\n" . ' <soap:address location="' . $address . '"/>';
5623  $xml .= "\n" . ' </port>';
5624  }
5625  }
5626 
5627  $xml .= "\n" . '</service>';
5628  return $xml . "\n</definitions>";
5629  }
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:5297
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:821
getPrefixFromNamespace($ns)
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given...
Definition: nusoap.php:872
$_GET['client_id']
Definition: saml1-acs.php:21
$xml
Definition: metadata.php:351
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:839
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:855
+ 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 6211 of file nusoap.php.

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

6212  {
6213  $xml = '';
6214  if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) {
6215  $this->debug("serialize attributes for XML Schema type $ns:$uqType");
6216  if (is_array($value)) {
6217  $xvalue = $value;
6218  } elseif (is_object($value)) {
6219  $xvalue = get_object_vars($value);
6220  } else {
6221  $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
6222  $xvalue = array();
6223  }
6224  foreach ($typeDef['attrs'] as $aName => $attrs) {
6225  if (isset($xvalue['!' . $aName])) {
6226  $xname = '!' . $aName;
6227  $this->debug("value provided for attribute $aName with key $xname");
6228  } elseif (isset($xvalue[$aName])) {
6229  $xname = $aName;
6230  $this->debug("value provided for attribute $aName with key $xname");
6231  } elseif (isset($attrs['default'])) {
6232  $xname = '!' . $aName;
6233  $xvalue[$xname] = $attrs['default'];
6234  $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName);
6235  } else {
6236  $xname = '';
6237  $this->debug("no value provided for attribute $aName");
6238  }
6239  if ($xname) {
6240  $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
6241  }
6242  }
6243  } else {
6244  $this->debug("no attributes to serialize for XML Schema type $ns:$uqType");
6245  }
6246  if (isset($typeDef['extensionBase'])) {
6247  $ns = $this->getPrefix($typeDef['extensionBase']);
6248  $uqType = $this->getLocalPart($typeDef['extensionBase']);
6249  if ($this->getNamespaceFromPrefix($ns)) {
6250  $ns = $this->getNamespaceFromPrefix($ns);
6251  }
6252  if ($typeDef = $this->getTypeDef($uqType, $ns)) {
6253  $this->debug("serialize attributes for extension base $ns:$uqType");
6254  $xml .= $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
6255  } else {
6256  $this->debug("extension base $ns:$uqType is not a supported type");
6257  }
6258  }
6259  return $xml;
6260  }
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:5297
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:821
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
$xml
Definition: metadata.php:351
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:839
expandEntities($val)
expands entities, e.g.
Definition: nusoap.php:363
serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType)
serializes the attributes for a complexType
Definition: nusoap.php:6211
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:855
+ 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 6274 of file nusoap.php.

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

6275  {
6276  $xml = '';
6277  if (isset($typeDef['elements']) && is_array($typeDef['elements'])) {
6278  $this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType");
6279  if (is_array($value)) {
6280  $xvalue = $value;
6281  } elseif (is_object($value)) {
6282  $xvalue = get_object_vars($value);
6283  } else {
6284  $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
6285  $xvalue = array();
6286  }
6287  // toggle whether all elements are present - ideally should validate against schema
6288  if (count($typeDef['elements']) != count($xvalue)) {
6289  $optionals = true;
6290  }
6291  foreach ($typeDef['elements'] as $eName => $attrs) {
6292  if (!isset($xvalue[$eName])) {
6293  if (isset($attrs['default'])) {
6294  $xvalue[$eName] = $attrs['default'];
6295  $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName);
6296  }
6297  }
6298  // if user took advantage of a minOccurs=0, then only serialize named parameters
6299  if (isset($optionals)
6300  && (!isset($xvalue[$eName]))
6301  && ((!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
6302  ) {
6303  if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') {
6304  $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']);
6305  }
6306  // do nothing
6307  $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing");
6308  } else {
6309  // get value
6310  if (isset($xvalue[$eName])) {
6311  $v = $xvalue[$eName];
6312  } else {
6313  $v = null;
6314  }
6315  if (isset($attrs['form'])) {
6316  $unqualified = ($attrs['form'] == 'unqualified');
6317  } else {
6318  $unqualified = false;
6319  }
6320  if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') {
6321  $vv = $v;
6322  foreach ($vv as $k => $v) {
6323  if (isset($attrs['type']) || isset($attrs['ref'])) {
6324  // serialize schema-defined type
6325  $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
6326  } else {
6327  // serialize generic type (can this ever really happen?)
6328  $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
6329  $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
6330  }
6331  }
6332  } else {
6333  if (isset($attrs['type']) || isset($attrs['ref'])) {
6334  // serialize schema-defined type
6335  $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
6336  } else {
6337  // serialize generic type (can this ever really happen?)
6338  $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
6339  $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
6340  }
6341  }
6342  }
6343  }
6344  } else {
6345  $this->debug("no elements to serialize for XML Schema type $ns:$uqType");
6346  }
6347  if (isset($typeDef['extensionBase'])) {
6348  $ns = $this->getPrefix($typeDef['extensionBase']);
6349  $uqType = $this->getLocalPart($typeDef['extensionBase']);
6350  if ($this->getNamespaceFromPrefix($ns)) {
6351  $ns = $this->getNamespaceFromPrefix($ns);
6352  }
6353  if ($typeDef = $this->getTypeDef($uqType, $ns)) {
6354  $this->debug("serialize elements for extension base $ns:$uqType");
6355  $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
6356  } else {
6357  $this->debug("extension base $ns:$uqType is not a supported type");
6358  }
6359  }
6360  return $xml;
6361  }
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:5297
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:407
serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false)
serializes the elements for a complexType
Definition: nusoap.php:6274
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed ...
Definition: nusoap.php:821
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
$xml
Definition: metadata.php:351
serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
serializes a PHP value according a given type definition
Definition: nusoap.php:5907
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:839
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace
Definition: nusoap.php:855
serialize_val($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded', $soapval=false)
serializes PHP values in accordance w/ section 5.
Definition: nusoap.php:433
+ Here is the call graph for this function:

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

References $name, $type, $xml, nusoap_base\appendDebug(), nusoap_base\debug(), nusoap_base\isArraySimpleOrStruct(), nusoap_base\setError(), and nusoap_base\varDump().

5830  {
5831  $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion");
5832  $this->appendDebug('parameters=' . $this->varDump($parameters));
5833 
5834  if ($direction != 'input' && $direction != 'output') {
5835  $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
5836  $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
5837  return false;
5838  }
5839  if (!$opData = $this->getOperationData($operation)) {
5840  $this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
5841  $this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
5842  return false;
5843  }
5844  $this->debug('opData:');
5845  $this->appendDebug($this->varDump($opData));
5846 
5847  // Get encoding style for output and set to current
5848  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
5849  if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
5850  $encodingStyle = $opData['output']['encodingStyle'];
5851  $enc_style = $encodingStyle;
5852  }
5853 
5854  // set input params
5855  $xml = '';
5856  if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
5857  $use = $opData[$direction]['use'];
5858  $this->debug("use=$use");
5859  $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
5860  if (is_array($parameters)) {
5861  $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
5862  $this->debug('have ' . $parametersArrayType . ' parameters');
5863  foreach ($opData[$direction]['parts'] as $name => $type) {
5864  $this->debug('serializing part "' . $name . '" of type "' . $type . '"');
5865  // Track encoding style
5866  if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
5867  $encodingStyle = $opData[$direction]['encodingStyle'];
5868  $enc_style = $encodingStyle;
5869  } else {
5870  $enc_style = false;
5871  }
5872  // NOTE: add error handling here
5873  // if serializeType returns false, then catch global error and fault
5874  if ($parametersArrayType == 'arraySimple') {
5875  $p = array_shift($parameters);
5876  $this->debug('calling serializeType w/indexed param');
5877  $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
5878  } elseif (isset($parameters[$name])) {
5879  $this->debug('calling serializeType w/named param');
5880  $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
5881  } else {
5882  // TODO: only send nillable
5883  $this->debug('calling serializeType w/null param');
5884  $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
5885  }
5886  }
5887  } else {
5888  $this->debug('no parameters passed.');
5889  }
5890  }
5891  $this->debug("serializeParameters returning: $xml");
5892  return $xml;
5893  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:305
setError($str)
sets error string
Definition: nusoap.php:395
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:407
$type
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
if($format !==null) $name
Definition: metadata.php:247
$xml
Definition: metadata.php:351
serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
serializes a PHP value according a given type definition
Definition: nusoap.php:5907
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:909
getOperationData($operation, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:5226
$opData
Definition: nusoap.php:4635
+ 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 5734 of file nusoap.php.

References $name, $parts, $type, $xml, 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().

5735  {
5736  $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType");
5737  $this->appendDebug('parameters=' . $this->varDump($parameters));
5738 
5739  if ($direction != 'input' && $direction != 'output') {
5740  $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
5741  $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
5742  return false;
5743  }
5744  if (!$opData = $this->getOperationData($operation, $bindingType)) {
5745  $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
5746  $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
5747  return false;
5748  }
5749  $this->debug('in serializeRPCParameters: opData:');
5750  $this->appendDebug($this->varDump($opData));
5751 
5752  // Get encoding style for output and set to current
5753  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
5754  if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
5755  $encodingStyle = $opData['output']['encodingStyle'];
5756  $enc_style = $encodingStyle;
5757  }
5758 
5759  // set input params
5760  $xml = '';
5761  if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
5762  $parts = &$opData[$direction]['parts'];
5763  $part_count = sizeof($parts);
5764  $style = $opData['style'];
5765  $use = $opData[$direction]['use'];
5766  $this->debug("have $part_count part(s) to serialize using $style/$use");
5767  if (is_array($parameters)) {
5768  $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
5769  $parameter_count = count($parameters);
5770  $this->debug("have $parameter_count parameter(s) provided as $parametersArrayType to serialize");
5771  // check for Microsoft-style wrapped parameters
5772  if ($style == 'document' && $use == 'literal' && $part_count == 1 && isset($parts['parameters'])) {
5773  $this->debug('check whether the caller has wrapped the parameters');
5774  if ((($parametersArrayType == 'arrayStruct' || $parameter_count == 0) && !isset($parameters['parameters'])) || ($direction == 'output' && $parametersArrayType == 'arraySimple' && $parameter_count == 1)) {
5775  $this->debug('check whether caller\'s parameters match the wrapped ones');
5776  if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) {
5777  $this->debug('wrap the parameters for the caller');
5778  $parameters = array('parameters' => $parameters);
5779  $parameter_count = 1;
5780  }
5781  }
5782  }
5783  foreach ($parts as $name => $type) {
5784  $this->debug("serializing part $name of type $type");
5785  // Track encoding style
5786  if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
5787  $encodingStyle = $opData[$direction]['encodingStyle'];
5788  $enc_style = $encodingStyle;
5789  } else {
5790  $enc_style = false;
5791  }
5792  // NOTE: add error handling here
5793  // if serializeType returns false, then catch global error and fault
5794  if ($parametersArrayType == 'arraySimple') {
5795  $p = array_shift($parameters);
5796  $this->debug('calling serializeType w/indexed param');
5797  $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
5798  } elseif (isset($parameters[$name])) {
5799  $this->debug('calling serializeType w/named param');
5800  $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
5801  } else {
5802  // TODO: only send nillable
5803  $this->debug('calling serializeType w/null param');
5804  $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
5805  }
5806  }
5807  } else {
5808  $this->debug('no parameters passed.');
5809  }
5810  }
5811  $this->debug("serializeRPCParameters returning: $xml");
5812  return $xml;
5813  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:305
setError($str)
sets error string
Definition: nusoap.php:395
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:407
$type
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
if($format !==null) $name
Definition: metadata.php:247
$xml
Definition: metadata.php:351
serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
serializes a PHP value according a given type definition
Definition: nusoap.php:5907
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:909
getOperationData($operation, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:5226
$opData
Definition: nusoap.php:4635
parametersMatchWrapped($type, &$parameters)
determine whether a set of parameters are unwrapped when they are expect to be wrapped, Microsoft-style.
Definition: nusoap.php:5640
+ 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 5907 of file nusoap.php.

References $cols, $name, $rows, $type, $xml, 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().

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

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

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

Referenced by nusoap_client\loadWSDL().

5171  {
5172  $this->debug("setCredentials username=$username authtype=$authtype certRequest=");
5173  $this->appendDebug($this->varDump($certRequest));
5174  $this->username = $username;
5175  $this->password = $password;
5176  $this->authtype = $authtype;
5177  $this->certRequest = $certRequest;
5178  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:305
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
$password
Definition: nusoap.php:4657
$authtype
Definition: nusoap.php:4658
$username
Definition: nusoap.php:4656
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:909
$certRequest
Definition: nusoap.php:4659
+ 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 4906 of file nusoap.php.

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

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

◆ webDescription()

wsdl::webDescription ( )

prints html description of services

private

Definition at line 5354 of file nusoap.php.

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

Referenced by nusoap_server\service().

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

Field Documentation

◆ $authtype

wsdl::$authtype = ''

Definition at line 4658 of file nusoap.php.

◆ $bindings

wsdl::$bindings = array()

Definition at line 4631 of file nusoap.php.

◆ $certRequest

wsdl::$certRequest = array()

Definition at line 4659 of file nusoap.php.

◆ $complexTypes

wsdl::$complexTypes = array()

Definition at line 4625 of file nusoap.php.

◆ $curl_options

wsdl::$curl_options = array()

Definition at line 4653 of file nusoap.php.

◆ $currentBinding

wsdl::$currentBinding

Definition at line 4632 of file nusoap.php.

◆ $currentMessage

wsdl::$currentMessage

Definition at line 4627 of file nusoap.php.

◆ $currentOperation

wsdl::$currentOperation

Definition at line 4628 of file nusoap.php.

◆ $currentPort

wsdl::$currentPort

Definition at line 4634 of file nusoap.php.

◆ $currentPortType

wsdl::$currentPortType

Definition at line 4630 of file nusoap.php.

◆ $currentSchema

wsdl::$currentSchema

Definition at line 4623 of file nusoap.php.

◆ $depth

wsdl::$depth = 0

Definition at line 4644 of file nusoap.php.

◆ $depth_array

wsdl::$depth_array = array()

Definition at line 4645 of file nusoap.php.

◆ $documentation

wsdl::$documentation = false

Definition at line 4637 of file nusoap.php.

◆ $endpoint

wsdl::$endpoint = ''

Definition at line 4638 of file nusoap.php.

◆ $import

wsdl::$import = array()

Definition at line 4640 of file nusoap.php.

◆ $message

wsdl::$message = array()

Definition at line 4624 of file nusoap.php.

◆ $messages

wsdl::$messages = array()

Definition at line 4626 of file nusoap.php.

◆ $opData

wsdl::$opData = array()

Definition at line 4635 of file nusoap.php.

◆ $parser

wsdl::$parser

Definition at line 4642 of file nusoap.php.

◆ $password

wsdl::$password = ''

Definition at line 4657 of file nusoap.php.

◆ $ports

wsdl::$ports = array()

Definition at line 4633 of file nusoap.php.

◆ $portTypes

wsdl::$portTypes = array()

Definition at line 4629 of file nusoap.php.

◆ $position

wsdl::$position = 0

Definition at line 4643 of file nusoap.php.

◆ $proxyhost

wsdl::$proxyhost = ''

Definition at line 4647 of file nusoap.php.

◆ $proxypassword

wsdl::$proxypassword = ''

Definition at line 4650 of file nusoap.php.

◆ $proxyport

wsdl::$proxyport = ''

Definition at line 4648 of file nusoap.php.

◆ $proxyusername

wsdl::$proxyusername = ''

Definition at line 4649 of file nusoap.php.

◆ $response_timeout

wsdl::$response_timeout = 30

Definition at line 4652 of file nusoap.php.

◆ $schemas

wsdl::$schemas = array()

Definition at line 4622 of file nusoap.php.

◆ $status

wsdl::$status = ''

Definition at line 4636 of file nusoap.php.

◆ $timeout

wsdl::$timeout = 0

Definition at line 4651 of file nusoap.php.

◆ $use_curl

wsdl::$use_curl = false

Definition at line 4654 of file nusoap.php.

◆ $username

wsdl::$username = ''

Definition at line 4656 of file nusoap.php.

◆ $wsdl

wsdl::$wsdl

Definition at line 4620 of file nusoap.php.


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