ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 4615 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 4673 of file nusoap.php.

References ILIAS\MetaData\Repository\Validation\Data\__construct(), and nusoap_base\debug().

4674  {
4676  $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
4677  $this->proxyhost = $proxyhost;
4678  $this->proxyport = $proxyport;
4679  $this->proxyusername = $proxyusername;
4680  $this->proxypassword = $proxypassword;
4681  $this->timeout = $timeout;
4682  $this->response_timeout = $response_timeout;
4683  if (is_array($curl_options)) {
4684  $this->curl_options = $curl_options;
4685  }
4686  $this->use_curl = $use_curl;
4687  $this->fetchWSDL($wsdl);
4688  }
$proxyhost
Definition: nusoap.php:4645
$wsdl
Definition: nusoap.php:4618
$use_curl
Definition: nusoap.php:4652
$proxyusername
Definition: nusoap.php:4647
$curl_options
Definition: nusoap.php:4651
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:292
$proxyport
Definition: nusoap.php:4646
__construct(VocabulariesInterface $vocabularies)
$response_timeout
Definition: nusoap.php:4650
$timeout
Definition: nusoap.php:4649
fetchWSDL($wsdl)
fetches the WSDL document and parses it
Definition: nusoap.php:4695
$proxypassword
Definition: nusoap.php:4648
+ 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 6375 of file nusoap.php.

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

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

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

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

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

Referenced by nusoap_server\register().

6459  {
6460  if ($use == 'encoded' && $encodingStyle == '') {
6461  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
6462  }
6463 
6464  if ($style == 'document') {
6465  $elements = array();
6466  foreach ($in as $n => $t) {
6467  $elements[$n] = array('name' => $n, 'type' => $t);
6468  }
6469  $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements);
6470  $this->addElement(array('name' => $name, 'type' => $name . 'RequestType'));
6471  $in = array('parameters' => 'tns:' . $name . '^');
6472 
6473  $elements = array();
6474  foreach ($out as $n => $t) {
6475  $elements[$n] = array('name' => $n, 'type' => $t);
6476  }
6477  $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements);
6478  $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified'));
6479  $out = array('parameters' => 'tns:' . $name . 'Response' . '^');
6480  }
6481 
6482  // get binding
6483  $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] =
6484  array(
6485  'name' => $name,
6486  'binding' => $this->serviceName . 'Binding',
6487  'endpoint' => $this->endpoint,
6488  'soapAction' => $soapaction,
6489  'style' => $style,
6490  'input' => array(
6491  'use' => $use,
6492  'namespace' => $namespace,
6493  'encodingStyle' => $encodingStyle,
6494  'message' => $name . 'Request',
6495  'parts' => $in),
6496  'output' => array(
6497  'use' => $use,
6498  'namespace' => $namespace,
6499  'encodingStyle' => $encodingStyle,
6500  'message' => $name . 'Response',
6501  'parts' => $out),
6502  'namespace' => $namespace,
6503  'transport' => 'http://schemas.xmlsoap.org/soap/http',
6504  'documentation' => $documentation);
6505  // add portTypes
6506  // add messages
6507  if ($in) {
6508  foreach ($in as $pName => $pType) {
6509  if (strpos($pType, ':')) {
6510  $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)) . ":" . $this->getLocalPart($pType);
6511  }
6512  $this->messages[$name . 'Request'][$pName] = $pType;
6513  }
6514  } else {
6515  $this->messages[$name . 'Request']= '0';
6516  }
6517  if ($out) {
6518  foreach ($out as $pName => $pType) {
6519  if (strpos($pType, ':')) {
6520  $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)) . ":" . $this->getLocalPart($pType);
6521  }
6522  $this->messages[$name . 'Response'][$pName] = $pType;
6523  }
6524  } else {
6525  $this->messages[$name . 'Response']= '0';
6526  }
6527  return true;
6528  }
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:6375
$documentation
Definition: nusoap.php:4635
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:6438
$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 6423 of file nusoap.php.

References nusoap_base\expandQname().

6424  {
6425  $restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase;
6426 
6427  $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6428  $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration);
6429  }
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 5148 of file nusoap.php.

References $data.

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

◆ end_element()

wsdl::end_element (   $parser,
  $name 
)

end-element handler

Parameters
string$parserXML parser object
string$nameelement name private

Definition at line 5117 of file nusoap.php.

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

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

◆ fetchWSDL()

wsdl::fetchWSDL (   $wsdl)

fetches the WSDL document and parses it

public

Definition at line 4695 of file nusoap.php.

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

Referenced by nusoap_client\loadWSDL().

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

◆ getBindingData()

wsdl::getBindingData (   $binding)

Definition at line 5178 of file nusoap.php.

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

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

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

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

Referenced by nusoap_server\invoke_method().

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

Referenced by nusoap_client\checkWSDL().

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

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

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

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

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

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

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

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

Referenced by nusoap_server\service().

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

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

6210  {
6211  $xml = '';
6212  if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) {
6213  $this->debug("serialize attributes for XML Schema type $ns:$uqType");
6214  if (is_array($value)) {
6215  $xvalue = $value;
6216  } elseif (is_object($value)) {
6217  $xvalue = get_object_vars($value);
6218  } else {
6219  $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
6220  $xvalue = array();
6221  }
6222  foreach ($typeDef['attrs'] as $aName => $attrs) {
6223  if (isset($xvalue['!' . $aName])) {
6224  $xname = '!' . $aName;
6225  $this->debug("value provided for attribute $aName with key $xname");
6226  } elseif (isset($xvalue[$aName])) {
6227  $xname = $aName;
6228  $this->debug("value provided for attribute $aName with key $xname");
6229  } elseif (isset($attrs['default'])) {
6230  $xname = '!' . $aName;
6231  $xvalue[$xname] = $attrs['default'];
6232  $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName);
6233  } else {
6234  $xname = '';
6235  $this->debug("no value provided for attribute $aName");
6236  }
6237  if ($xname) {
6238  $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
6239  }
6240  }
6241  } else {
6242  $this->debug("no attributes to serialize for XML Schema type $ns:$uqType");
6243  }
6244  if (isset($typeDef['extensionBase'])) {
6245  $ns = $this->getPrefix($typeDef['extensionBase']);
6246  $uqType = $this->getLocalPart($typeDef['extensionBase']);
6247  if ($this->getNamespaceFromPrefix($ns)) {
6248  $ns = $this->getNamespaceFromPrefix($ns);
6249  }
6250  if ($typeDef = $this->getTypeDef($uqType, $ns)) {
6251  $this->debug("serialize attributes for extension base $ns:$uqType");
6252  $xml .= $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
6253  } else {
6254  $this->debug("extension base $ns:$uqType is not a supported type");
6255  }
6256  }
6257  return $xml;
6258  }
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:5295
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
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:6209
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 6272 of file nusoap.php.

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

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

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

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

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

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

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

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

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

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

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

Referenced by nusoap_client\loadWSDL().

5169  {
5170  $this->debug("setCredentials username=$username authtype=$authtype certRequest=");
5171  $this->appendDebug($this->varDump($certRequest));
5172  $this->username = $username;
5173  $this->password = $password;
5174  $this->authtype = $authtype;
5175  $this->certRequest = $certRequest;
5176  }
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:4655
$authtype
Definition: nusoap.php:4656
$username
Definition: nusoap.php:4654
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:909
$certRequest
Definition: nusoap.php:4657
+ 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 4904 of file nusoap.php.

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

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

◆ webDescription()

wsdl::webDescription ( )

prints html description of services

private

Definition at line 5352 of file nusoap.php.

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

Referenced by nusoap_server\service().

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

Field Documentation

◆ $authtype

wsdl::$authtype = ''

Definition at line 4656 of file nusoap.php.

◆ $bindings

wsdl::$bindings = array()

Definition at line 4629 of file nusoap.php.

◆ $certRequest

wsdl::$certRequest = array()

Definition at line 4657 of file nusoap.php.

◆ $complexTypes

wsdl::$complexTypes = array()

Definition at line 4623 of file nusoap.php.

◆ $curl_options

wsdl::$curl_options = array()

Definition at line 4651 of file nusoap.php.

◆ $currentBinding

wsdl::$currentBinding

Definition at line 4630 of file nusoap.php.

◆ $currentMessage

wsdl::$currentMessage

Definition at line 4625 of file nusoap.php.

◆ $currentOperation

wsdl::$currentOperation

Definition at line 4626 of file nusoap.php.

◆ $currentPort

wsdl::$currentPort

Definition at line 4632 of file nusoap.php.

◆ $currentPortType

wsdl::$currentPortType

Definition at line 4628 of file nusoap.php.

◆ $currentSchema

wsdl::$currentSchema

Definition at line 4621 of file nusoap.php.

◆ $depth

wsdl::$depth = 0

Definition at line 4642 of file nusoap.php.

◆ $depth_array

wsdl::$depth_array = array()

Definition at line 4643 of file nusoap.php.

◆ $documentation

wsdl::$documentation = false

Definition at line 4635 of file nusoap.php.

◆ $endpoint

wsdl::$endpoint = ''

Definition at line 4636 of file nusoap.php.

◆ $import

wsdl::$import = array()

Definition at line 4638 of file nusoap.php.

◆ $message

wsdl::$message = array()

Definition at line 4622 of file nusoap.php.

◆ $messages

wsdl::$messages = array()

Definition at line 4624 of file nusoap.php.

◆ $opData

wsdl::$opData = array()

Definition at line 4633 of file nusoap.php.

◆ $parser

wsdl::$parser

Definition at line 4640 of file nusoap.php.

◆ $password

wsdl::$password = ''

Definition at line 4655 of file nusoap.php.

◆ $ports

wsdl::$ports = array()

Definition at line 4631 of file nusoap.php.

◆ $portTypes

wsdl::$portTypes = array()

Definition at line 4627 of file nusoap.php.

◆ $position

wsdl::$position = 0

Definition at line 4641 of file nusoap.php.

◆ $proxyhost

wsdl::$proxyhost = ''

Definition at line 4645 of file nusoap.php.

◆ $proxypassword

wsdl::$proxypassword = ''

Definition at line 4648 of file nusoap.php.

◆ $proxyport

wsdl::$proxyport = ''

Definition at line 4646 of file nusoap.php.

◆ $proxyusername

wsdl::$proxyusername = ''

Definition at line 4647 of file nusoap.php.

◆ $response_timeout

wsdl::$response_timeout = 30

Definition at line 4650 of file nusoap.php.

◆ $schemas

wsdl::$schemas = array()

Definition at line 4620 of file nusoap.php.

◆ $status

wsdl::$status = ''

Definition at line 4634 of file nusoap.php.

◆ $timeout

wsdl::$timeout = 0

Definition at line 4649 of file nusoap.php.

◆ $use_curl

wsdl::$use_curl = false

Definition at line 4652 of file nusoap.php.

◆ $username

wsdl::$username = ''

Definition at line 4654 of file nusoap.php.

◆ $wsdl

wsdl::$wsdl

Definition at line 4618 of file nusoap.php.


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