ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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

 wsdl ($wsdl='', $proxyhost=false, $proxyport=false, $proxyusername=false, $proxypassword=false, $timeout=0, $response_timeout=30)
 constructor 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...
 
 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...
 
 getTypeDef ($type, $ns)
 returns an array of information about a given type returns false if no type exists by the given name More...
 
 serialize ()
 serialize the parsed wsdl More...
 
 serializeRPCParameters ($operation, $direction, $parameters)
 serialize a PHP value according to a WSDL message definition More...
 
 serializeParameters ($operation, $direction, $parameters)
 serialize a PHP value according to a WSDL message definition More...
 
 serializeType ($name, $type, $value, $use='encoded', $encodingStyle=false)
 serializes a PHP value according a given type definition 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')
 adds an XML Schema simple type to the WSDL types More...
 
 addOperation ($name, $in=false, $out=false, $namespace=false, $soapaction=false, $style='rpc', $use='encoded', $documentation='')
 register a service with the server More...
 
 __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
 debug ($string)
 adds debug data to the class level debug string 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')
 
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded')
 serialize message More...
 
 formatDump ($str)
 
 contractQname ($qname)
 contracts a qualified name More...
 
 expandQname ($qname)
 expands 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 returns false if no namespace registered with the given prefix More...
 
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace More...
 
 varDump ($data)
 
 __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)
 
 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.6.7'
 
 $revision = '$Revision$'
 
 $error_str = false
 Current error string (manipulated by getError/setError) More...
 
 $debug_str = ''
 Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment) More...
 
 $charencoding = true
 
 $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 
 $soap_defencoding = 'UTF-8'
 
 $namespaces
 
 $usedNamespaces = array()
 
 $typemap
 
 $xmlEntities
 
 $debugLevel
 

Detailed Description

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

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

Author
Dietrich Ayala dietr.nosp@m.ich@.nosp@m.ganx4.nosp@m..com @access public

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

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

Definition at line 4568 of file nusoap.php.

4568 {
4569 parent::__construct();
4570 $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
4571 $this->proxyhost = $proxyhost;
4572 $this->proxyport = $proxyport;
4573 $this->proxyusername = $proxyusername;
4574 $this->proxypassword = $proxypassword;
4575 $this->timeout = $timeout;
4576 $this->response_timeout = $response_timeout;
4577 if (is_array($curl_options))
4578 $this->curl_options = $curl_options;
4579 $this->use_curl = $use_curl;
4580 $this->fetchWSDL($wsdl);
4581 }
debug($string)
adds debug data to the class level debug string
Definition: nusoap.php:144
$proxyhost
Definition: nusoap.php:3162
$proxypassword
Definition: nusoap.php:3165
fetchWSDL($wsdl)
fetches the WSDL document and parses it
Definition: nusoap.php:4588
$wsdl
Definition: nusoap.php:3135
$timeout
Definition: nusoap.php:3166
$use_curl
Definition: nusoap.php:4547
$proxyusername
Definition: nusoap.php:3164
$proxyport
Definition: nusoap.php:3163
$curl_options
Definition: nusoap.php:4546
$response_timeout
Definition: nusoap.php:3167

References $curl_options, $proxyhost, $proxypassword, $proxyport, $proxyusername, $response_timeout, $timeout, $use_curl, nusoap_base\debug(), and fetchWSDL().

+ Here is the call graph for this function:

Member Function Documentation

◆ addComplexType() [1/2]

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
name
typeClass(complexType|simpleType|attribute)
phpTypecurrently supported are array and struct (php assoc array)
compositor(all|sequence|choice)
restrictionBasenamespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
elements= array ( name = array(name=>'',type=>'') )
attrs= array( array( 'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType", "http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]" ) )
arrayTypenamespace:name (http://www.w3.org/2001/XMLSchema:string)
See also
xmlschema

Definition at line 4298 of file nusoap.php.

4298 {
4299 if (count($elements) > 0) {
4300 foreach($elements as $n => $e){
4301 // expand each element
4302 foreach ($e as $k => $v) {
4303 $k = strpos($k,':') ? $this->expandQname($k) : $k;
4304 $v = strpos($v,':') ? $this->expandQname($v) : $v;
4305 $ee[$k] = $v;
4306 }
4307 $eElements[$n] = $ee;
4308 }
4309 $elements = $eElements;
4310 }
4311
4312 if (count($attrs) > 0) {
4313 foreach($attrs as $n => $a){
4314 // expand each attribute
4315 foreach ($a as $k => $v) {
4316 $k = strpos($k,':') ? $this->expandQname($k) : $k;
4317 $v = strpos($v,':') ? $this->expandQname($v) : $v;
4318 $aa[$k] = $v;
4319 }
4320 $eAttrs[$n] = $aa;
4321 }
4322 $attrs = $eAttrs;
4323 }
4324
4325 $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
4326 $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType;
4327
4328 $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
4329 $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType);
4330 }
$n
Definition: RandomTest.php:85
expandQname($qname)
expands a qualified name
Definition: nusoap.php:483

References $n, $name, and nusoap_base\expandQname().

Referenced by addOperation().

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

◆ addComplexType() [2/2]

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 @access User interface

Definition at line 6257 of file nusoap.php.

6257 {
6258 if (count($elements) > 0) {
6259 $eElements = array();
6260 foreach($elements as $n => $e){
6261 // expand each element
6262 $ee = array();
6263 foreach ($e as $k => $v) {
6264 $k = strpos($k,':') ? $this->expandQname($k) : $k;
6265 $v = strpos($v,':') ? $this->expandQname($v) : $v;
6266 $ee[$k] = $v;
6267 }
6268 $eElements[$n] = $ee;
6269 }
6270 $elements = $eElements;
6271 }
6272
6273 if (count($attrs) > 0) {
6274 foreach($attrs as $n => $a){
6275 // expand each attribute
6276 foreach ($a as $k => $v) {
6277 $k = strpos($k,':') ? $this->expandQname($k) : $k;
6278 $v = strpos($v,':') ? $this->expandQname($v) : $v;
6279 $aa[$k] = $v;
6280 }
6281 $eAttrs[$n] = $aa;
6282 }
6283 $attrs = $eAttrs;
6284 }
6285
6286 $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
6287 $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType;
6288
6289 $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6290 $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType);
6291 }

References $n, $name, and nusoap_base\expandQname().

+ 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 @access User interface

Definition at line 6318 of file nusoap.php.

6318 {
6319 $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6320 $this->schemas[$typens][0]->addElement($attrs);
6321 }

Referenced by addOperation().

+ Here is the caller graph for this function:

◆ addOperation() [1/2]

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

register a service with the server

Parameters
string$methodname
string$inassoc array of input values: key = param name, value = param type
string$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
string$use(encoded|literal) optional The use for the parameters (cannot mix right now)
string$documentationoptional The description to include in the WSDL @access public

Definition at line 4362 of file nusoap.php.

4362 {
4363 if ($style == 'rpc' && $use == 'encoded') {
4364 $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
4365 } else {
4366 $encodingStyle = '';
4367 }
4368 // get binding
4369 $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] =
4370 array(
4371 'name' => $name,
4372 'binding' => $this->serviceName . 'Binding',
4373 'endpoint' => $this->endpoint,
4374 'soapAction' => $soapaction,
4375 'style' => $style,
4376 'input' => array(
4377 'use' => $use,
4378 'namespace' => $namespace,
4379 'encodingStyle' => $encodingStyle,
4380 'message' => $name . 'Request',
4381 'parts' => $in),
4382 'output' => array(
4383 'use' => $use,
4384 'namespace' => $namespace,
4385 'encodingStyle' => $encodingStyle,
4386 'message' => $name . 'Response',
4387 'parts' => $out),
4388 'namespace' => $namespace,
4389 'transport' => 'http://schemas.xmlsoap.org/soap/http',
4390 'documentation' => $documentation);
4391 // add portTypes
4392 // add messages
4393 if($in)
4394 {
4395 foreach($in as $pName => $pType)
4396 {
4397 if(strpos($pType,':')) {
4398 $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
4399 }
4400 $this->messages[$name.'Request'][$pName] = $pType;
4401 }
4402 } else {
4403 $this->messages[$name.'Request']= '0';
4404 }
4405 if($out)
4406 {
4407 foreach($out as $pName => $pType)
4408 {
4409 if(strpos($pType,':')) {
4410 $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
4411 }
4412 $this->messages[$name.'Response'][$pName] = $pType;
4413 }
4414 } else {
4415 $this->messages[$name.'Response']= '0';
4416 }
4417 return true;
4418 }
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
getPrefix($str)
returns the prefix part of a prefixed string returns false, if not prefixed
Definition: nusoap.php:525
getNamespaceFromPrefix($prefix)
pass it a prefix, it returns a namespace returns false if no namespace registered with the given pref...
Definition: nusoap.php:541
getLocalPart($str)
returns the local part of a prefixed string returns the original string, if not prefixed
Definition: nusoap.php:508
$documentation
Definition: nusoap.php:3152
if($err=$client->getError()) $namespace
$style
Definition: example_012.php:70

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

Referenced by nusoap_server\register(), and soap_server\register().

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

◆ addOperation() [2/2]

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) @access public

Definition at line 6337 of file nusoap.php.

6337 {
6338 if ($use == 'encoded' && $encodingStyle == '') {
6339 $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
6340 }
6341
6342 if ($style == 'document') {
6343 $elements = array();
6344 foreach ($in as $n => $t) {
6345 $elements[$n] = array('name' => $n, 'type' => $t);
6346 }
6347 $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements);
6348 $this->addElement(array('name' => $name, 'type' => $name . 'RequestType'));
6349 $in = array('parameters' => 'tns:' . $name . '^');
6350
6351 $elements = array();
6352 foreach ($out as $n => $t) {
6353 $elements[$n] = array('name' => $n, 'type' => $t);
6354 }
6355 $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements);
6356 $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified'));
6357 $out = array('parameters' => 'tns:' . $name . 'Response' . '^');
6358 }
6359
6360 // get binding
6361 $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] =
6362 array(
6363 'name' => $name,
6364 'binding' => $this->serviceName . 'Binding',
6365 'endpoint' => $this->endpoint,
6366 'soapAction' => $soapaction,
6367 'style' => $style,
6368 'input' => array(
6369 'use' => $use,
6370 'namespace' => $namespace,
6371 'encodingStyle' => $encodingStyle,
6372 'message' => $name . 'Request',
6373 'parts' => $in),
6374 'output' => array(
6375 'use' => $use,
6376 'namespace' => $namespace,
6377 'encodingStyle' => $encodingStyle,
6378 'message' => $name . 'Response',
6379 'parts' => $out),
6380 'namespace' => $namespace,
6381 'transport' => 'http://schemas.xmlsoap.org/soap/http',
6382 'documentation' => $documentation);
6383 // add portTypes
6384 // add messages
6385 if($in)
6386 {
6387 foreach($in as $pName => $pType)
6388 {
6389 if(strpos($pType,':')) {
6390 $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
6391 }
6392 $this->messages[$name.'Request'][$pName] = $pType;
6393 }
6394 } else {
6395 $this->messages[$name.'Request']= '0';
6396 }
6397 if($out)
6398 {
6399 foreach($out as $pName => $pType)
6400 {
6401 if(strpos($pType,':')) {
6402 $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
6403 }
6404 $this->messages[$name.'Response'][$pName] = $pType;
6405 }
6406 } else {
6407 $this->messages[$name.'Response']= '0';
6408 }
6409 return true;
6410 }
addElement($attrs)
adds an element to the WSDL types
Definition: nusoap.php:6318
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:4298

References $documentation, $in, $n, $name, $namespace, $out, $style, $t, addComplexType(), addElement(), nusoap_base\getLocalPart(), nusoap_base\getNamespaceFromPrefix(), and nusoap_base\getPrefix().

+ Here is the call graph for this function:

◆ addSimpleType() [1/2]

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

adds an XML Schema simple type to the WSDL types

Parameters
name
restrictionBasenamespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
typeClass(simpleType)
phpType(scalar)
See also
xmlschema

Definition at line 4342 of file nusoap.php.

4342 {
4343 $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
4344
4345 $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
4346 $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType);
4347 }

References $name, and nusoap_base\expandQname().

+ Here is the call graph for this function:

◆ addSimpleType() [2/2]

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 @access User interface

Definition at line 6304 of file nusoap.php.

6304 {
6305 $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
6306
6307 $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6308 $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration);
6309 }

References $name, and nusoap_base\expandQname().

+ Here is the call graph for this function:

◆ character_data() [1/2]

wsdl::character_data (   $parser,
  $data 
)

element content handler

Parameters
string$parserXML parser object
string$dataelement content @access private

Definition at line 3624 of file nusoap.php.

3625 {
3626 $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
3627 if (isset($this->message[$pos]['cdata'])) {
3628 $this->message[$pos]['cdata'] .= $data;
3629 }
3630 if ($this->documentation) {
3631 $this->documentation .= $data;
3632 }
3633 }
$depth
Definition: nusoap.php:3159
$data
Definition: bench.php:6

References $data, and $depth.

◆ character_data() [2/2]

wsdl::character_data (   $parser,
  $data 
)

element content handler

Parameters
string$parserXML parser object
string$dataelement content @access private

Definition at line 5038 of file nusoap.php.

5039 {
5040 $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
5041 if (isset($this->message[$pos]['cdata'])) {
5042 $this->message[$pos]['cdata'] .= $data;
5043 }
5044 if ($this->documentation) {
5045 $this->documentation .= $data;
5046 }
5047 }

References $data, and $depth.

◆ end_element() [1/2]

wsdl::end_element (   $parser,
  $name 
)

end-element handler

Parameters
string$parserXML parser object
string$nameelement name @access private

Definition at line 3597 of file nusoap.php.

3597 {
3598 // unset schema status
3599 if (/*ereg('types$', $name) ||*/ ereg('schema$', $name)) {
3600 $this->status = "";
3601 $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
3602 }
3603 if ($this->status == 'schema') {
3604 $this->currentSchema->schemaEndElement($parser, $name);
3605 } else {
3606 // bring depth down a notch
3607 $this->depth--;
3608 }
3609 // end documentation
3610 if ($this->documentation) {
3611 //TODO: track the node to which documentation should be assigned; it can be a part, message, etc.
3612 //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation;
3613 $this->documentation = false;
3614 }
3615 }
$currentSchema
Definition: nusoap.php:3138
$parser
Definition: nusoap.php:3157

References $currentSchema, $name, and $parser.

◆ end_element() [2/2]

wsdl::end_element (   $parser,
  $name 
)

end-element handler

Parameters
string$parserXML parser object
string$nameelement name @access private

Definition at line 5008 of file nusoap.php.

5008 {
5009 // unset schema status
5010 if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) {
5011 $this->status = "";
5012 $this->appendDebug($this->currentSchema->getDebug());
5013 $this->currentSchema->clearDebug();
5014 $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
5015 $this->debug('Parsing WSDL schema done');
5016 }
5017 if ($this->status == 'schema') {
5018 $this->currentSchema->schemaEndElement($parser, $name);
5019 } else {
5020 // bring depth down a notch
5021 $this->depth--;
5022 }
5023 // end documentation
5024 if ($this->documentation) {
5025 //TODO: track the node to which documentation should be assigned; it can be a part, message, etc.
5026 //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation;
5027 $this->documentation = false;
5028 }
5029 }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:294

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

+ Here is the call graph for this function:

◆ fetchWSDL()

wsdl::fetchWSDL (   $wsdl)

fetches the WSDL document and parses it

@access public

Definition at line 4588 of file nusoap.php.

4588 {
4589 $this->debug("parse and process WSDL path=$wsdl");
4590 $this->wsdl = $wsdl;
4591 // parse wsdl file
4592 if ($this->wsdl != "") {
4593 $this->parseWSDL($this->wsdl);
4594 }
4595 // imports
4596 // TODO: handle imports more properly, grabbing them in-line and nesting them
4597 $imported_urls = array();
4598 $imported = 1;
4599 while ($imported > 0) {
4600 $imported = 0;
4601 // Schema imports
4602 foreach ($this->schemas as $ns => $list) {
4603 foreach ($list as $xs) {
4604 $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
4605 foreach ($xs->imports as $ns2 => $list2) {
4606 for ($ii = 0; $ii < count($list2); $ii++) {
4607 if (! $list2[$ii]['loaded']) {
4608 $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
4609 $url = $list2[$ii]['location'];
4610 if ($url != '') {
4611 $urlparts = parse_url($url);
4612 if (!isset($urlparts['host'])) {
4613 $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') .
4614 substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
4615 }
4616 if (! in_array($url, $imported_urls)) {
4617 $this->parseWSDL($url);
4618 $imported++;
4619 $imported_urls[] = $url;
4620 }
4621 } else {
4622 $this->debug("Unexpected scenario: empty URL for unloaded import");
4623 }
4624 }
4625 }
4626 }
4627 }
4628 }
4629 // WSDL imports
4630 $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
4631 foreach ($this->import as $ns => $list) {
4632 for ($ii = 0; $ii < count($list); $ii++) {
4633 if (! $list[$ii]['loaded']) {
4634 $this->import[$ns][$ii]['loaded'] = true;
4635 $url = $list[$ii]['location'];
4636 if ($url != '') {
4637 $urlparts = parse_url($url);
4638 if (!isset($urlparts['host'])) {
4639 $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') .
4640 substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
4641 }
4642 if (! in_array($url, $imported_urls)) {
4643 $this->parseWSDL($url);
4644 $imported++;
4645 $imported_urls[] = $url;
4646 }
4647 } else {
4648 $this->debug("Unexpected scenario: empty URL for unloaded import");
4649 }
4650 }
4651 }
4652 }
4653 }
4654 // add new data to operation data
4655 foreach($this->bindings as $binding => $bindingData) {
4656 if (isset($bindingData['operations']) && is_array($bindingData['operations'])) {
4657 foreach($bindingData['operations'] as $operation => $data) {
4658 $this->debug('post-parse data gathering for ' . $operation);
4659 $this->bindings[$binding]['operations'][$operation]['input'] =
4660 isset($this->bindings[$binding]['operations'][$operation]['input']) ?
4661 array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) :
4662 $this->portTypes[ $bindingData['portType'] ][$operation]['input'];
4663 $this->bindings[$binding]['operations'][$operation]['output'] =
4664 isset($this->bindings[$binding]['operations'][$operation]['output']) ?
4665 array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) :
4666 $this->portTypes[ $bindingData['portType'] ][$operation]['output'];
4667 if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){
4668 $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ];
4669 }
4670 if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){
4671 $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ];
4672 }
4673 // Set operation style if necessary, but do not override one already provided
4674 if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) {
4675 $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style'];
4676 }
4677 $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : '';
4678 $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : '';
4679 $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : '';
4680 }
4681 }
4682 }
4683 }
parses a WSDL file, allows access to it's data, other utility methods
Definition: nusoap.php:3133
parseWSDL($wsdl='')
parses the wsdl document
Definition: nusoap.php:3290
$binding
$url
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41

References $binding, $data, $ii, $list, $url, $wsdl, nusoap_base\debug(), and parseWSDL().

Referenced by __construct(), and nusoap_client\loadWSDL().

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

◆ getBindingData() [1/2]

wsdl::getBindingData (   $binding)

Definition at line 3635 of file nusoap.php.

3636 {
3637 if (is_array($this->bindings[$binding])) {
3638 return $this->bindings[$binding];
3639 }
3640 }

References $binding.

◆ getBindingData() [2/2]

wsdl::getBindingData (   $binding)

Definition at line 5067 of file nusoap.php.

5068 {
5069 if (is_array($this->bindings[$binding])) {
5070 return $this->bindings[$binding];
5071 }
5072 }

References $binding.

◆ getOperationData() [1/2]

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

returns an associative array of data necessary for calling an operation

Parameters
string$operation,nameof operation
string$bindingType,typeof binding eg: soap
Returns
array @access public

Definition at line 3679 of file nusoap.php.

3680 {
3681 if ($bindingType == 'soap') {
3682 $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
3683 }
3684 // loop thru ports
3685 foreach($this->ports as $port => $portData) {
3686 // binding type of port matches parameter
3687 if ($portData['bindingType'] == $bindingType) {
3688 // get binding
3689 //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
3690 foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) {
3691 if ($operation == $bOperation) {
3692 $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
3693 return $opData;
3694 }
3695 }
3696 }
3697 }
3698 }
$opData
Definition: nusoap.php:3150

References $opData.

Referenced by soap_server\invoke_method(), nusoap_server\invoke_method(), serializeParameters(), serializeRPCParameters(), soap_server\verify_method(), and nusoap_server\verify_method().

+ Here is the caller graph for this function:

◆ getOperationData() [2/2]

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 @access public

Definition at line 5112 of file nusoap.php.

5113 {
5114 if ($bindingType == 'soap') {
5115 $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
5116 } elseif ($bindingType == 'soap12') {
5117 $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
5118 }
5119 // loop thru ports
5120 foreach($this->ports as $port => $portData) {
5121 // binding type of port matches parameter
5122 if ($portData['bindingType'] == $bindingType) {
5123 // get binding
5124 //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
5125 foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) {
5126 // note that we could/should also check the namespace here
5127 if ($operation == $bOperation) {
5128 $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
5129 return $opData;
5130 }
5131 }
5132 }
5133 }
5134 }

References $opData.

◆ 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 @access public

Definition at line 5144 of file nusoap.php.

5144 {
5145 if ($bindingType == 'soap') {
5146 $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
5147 } elseif ($bindingType == 'soap12') {
5148 $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
5149 }
5150 // loop thru ports
5151 foreach($this->ports as $port => $portData) {
5152 // binding type of port matches parameter
5153 if ($portData['bindingType'] == $bindingType) {
5154 // loop through operations for the binding
5155 foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
5156 if ($opData['soapAction'] == $soapAction) {
5157 return $opData;
5158 }
5159 }
5160 }
5161 }
5162 }

References $opData.

Referenced by nusoap_server\invoke_method().

+ Here is the caller graph for this function:

◆ getOperations() [1/2]

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

returns an assoc array of operation names => operation data

Parameters
string$bindingTypeeg: soap, smtp, dime (only soap is currently supported)
Returns
array @access public

Definition at line 3649 of file nusoap.php.

3650 {
3651 $ops = array();
3652 if ($bindingType == 'soap') {
3653 $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
3654 }
3655 // loop thru ports
3656 foreach($this->ports as $port => $portData) {
3657 // binding type of port matches parameter
3658 if ($portData['bindingType'] == $bindingType) {
3659 //$this->debug("getOperations for port $port");
3660 //$this->debug("port data: " . $this->varDump($portData));
3661 //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ]));
3662 // merge bindings
3663 if (isset($this->bindings[ $portData['binding'] ]['operations'])) {
3664 $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']);
3665 }
3666 }
3667 }
3668 return $ops;
3669 }

Referenced by nusoap_client\checkWSDL(), soap_client\soap_client(), soap_server\webDescription(), and webDescription().

+ Here is the caller graph for this function:

◆ getOperations() [2/2]

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 @access public

Definition at line 5081 of file nusoap.php.

5081 {
5082 $ops = array();
5083 if ($bindingType == 'soap') {
5084 $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
5085 } elseif ($bindingType == 'soap12') {
5086 $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
5087 }
5088 // loop thru ports
5089 foreach($this->ports as $port => $portData) {
5090 // binding type of port matches parameter
5091 if ($portData['bindingType'] == $bindingType) {
5092 //$this->debug("getOperations for port $port");
5093 //$this->debug("port data: " . $this->varDump($portData));
5094 //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ]));
5095 // merge bindings
5096 if (isset($this->bindings[ $portData['binding'] ]['operations'])) {
5097 $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']);
5098 }
5099 }
5100 }
5101 return $ops;
5102 }

◆ getTypeDef() [1/2]

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
$typestring
$nsstring
Returns
mixed @access public
See also
xmlschema

Definition at line 3718 of file nusoap.php.

3718 {
3719 if ((! $ns) && isset($this->namespaces['tns'])) {
3720 $ns = $this->namespaces['tns'];
3721 }
3722 if (isset($this->schemas[$ns])) {
3723 foreach ($this->schemas[$ns] as $xs) {
3724 $t = $xs->getTypeDef($type);
3725 $this->debug_str .= $xs->debug_str;
3726 $xs->debug_str = '';
3727 if ($t) {
3728 return $t;
3729 }
3730 }
3731 }
3732 return false;
3733 }
$type

References $t, and $type.

Referenced by getTypeDef(), parametersMatchWrapped(), serialize(), serializeComplexTypeAttributes(), serializeComplexTypeElements(), and serializeType().

+ Here is the caller graph for this function:

◆ getTypeDef() [2/2]

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 @access public
See also
nusoap_xmlschema

Definition at line 5182 of file nusoap.php.

5182 {
5183 $this->debug("in getTypeDef: type=$type, ns=$ns");
5184 if ((! $ns) && isset($this->namespaces['tns'])) {
5185 $ns = $this->namespaces['tns'];
5186 $this->debug("in getTypeDef: type namespace forced to $ns");
5187 }
5188 if (!isset($this->schemas[$ns])) {
5189 foreach ($this->schemas as $ns0 => $schema0) {
5190 if (strcasecmp($ns, $ns0) == 0) {
5191 $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0");
5192 $ns = $ns0;
5193 break;
5194 }
5195 }
5196 }
5197 if (isset($this->schemas[$ns])) {
5198 $this->debug("in getTypeDef: have schema for namespace $ns");
5199 for ($i = 0; $i < count($this->schemas[$ns]); $i++) {
5200 $xs = &$this->schemas[$ns][$i];
5201 $t = $xs->getTypeDef($type);
5202 //$this->appendDebug($xs->getDebug());
5203 //$xs->clearDebug();
5204 if ($t) {
5205 if (!isset($t['phpType'])) {
5206 // get info for type to tack onto the element
5207 $uqType = substr($t['type'], strrpos($t['type'], ':') + 1);
5208 $ns = substr($t['type'], 0, strrpos($t['type'], ':'));
5209 $etype = $this->getTypeDef($uqType, $ns);
5210 if ($etype) {
5211 $this->debug("found type for [element] $type:");
5212 $this->debug($this->varDump($etype));
5213 if (isset($etype['phpType'])) {
5214 $t['phpType'] = $etype['phpType'];
5215 }
5216 if (isset($etype['elements'])) {
5217 $t['elements'] = $etype['elements'];
5218 }
5219 if (isset($etype['attrs'])) {
5220 $t['attrs'] = $etype['attrs'];
5221 }
5222 }
5223 }
5224 return $t;
5225 }
5226 }
5227 } else {
5228 $this->debug("in getTypeDef: do not have schema for namespace $ns");
5229 }
5230 return false;
5231 }
varDump($data)
Definition: nusoap.php:567
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:3718
$i
Definition: disco.tpl.php:19

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

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

Definition at line 5523 of file nusoap.php.

5523 {
5524 $this->debug("in parametersMatchWrapped type=$type, parameters=");
5525 $this->appendDebug($this->varDump($parameters));
5526
5527 // split type into namespace:unqualified-type
5528 if (strpos($type, ':')) {
5529 $uqType = substr($type, strrpos($type, ':') + 1);
5530 $ns = substr($type, 0, strrpos($type, ':'));
5531 $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns");
5532 if ($this->getNamespaceFromPrefix($ns)) {
5533 $ns = $this->getNamespaceFromPrefix($ns);
5534 $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns");
5535 }
5536 } else {
5537 // TODO: should the type be compared to types in XSD, and the namespace
5538 // set to XSD if the type matches?
5539 $this->debug("in parametersMatchWrapped: No namespace for type $type");
5540 $ns = '';
5541 $uqType = $type;
5542 }
5543
5544 // get the type information
5545 if (!$typeDef = $this->getTypeDef($uqType, $ns)) {
5546 $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type.");
5547 return false;
5548 }
5549 $this->debug("in parametersMatchWrapped: found typeDef=");
5550 $this->appendDebug($this->varDump($typeDef));
5551 if (substr($uqType, -1) == '^') {
5552 $uqType = substr($uqType, 0, -1);
5553 }
5554 $phpType = $typeDef['phpType'];
5555 $arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '');
5556 $this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType");
5557
5558 // we expect a complexType or element of complexType
5559 if ($phpType != 'struct') {
5560 $this->debug("in parametersMatchWrapped: not a struct");
5561 return false;
5562 }
5563
5564 // see whether the parameter names match the elements
5565 if (isset($typeDef['elements']) && is_array($typeDef['elements'])) {
5566 $elements = 0;
5567 $matches = 0;
5568 $change = false;
5569 if ($this->isArraySimpleOrStruct($parameters) == 'arraySimple' && count($parameters) == count($typeDef['elements'])) {
5570 $this->debug("in parametersMatchWrapped: (wrapped return value kludge) correct number of elements in simple array, so change array and wrap");
5571 $change = true;
5572 }
5573 foreach ($typeDef['elements'] as $name => $attrs) {
5574 if ($change) {
5575 $this->debug("in parametersMatchWrapped: change parameter $element to name $name");
5576 $parameters[$name] = $parameters[$elements];
5577 unset($parameters[$elements]);
5578 $matches++;
5579 } elseif (isset($parameters[$name])) {
5580 $this->debug("in parametersMatchWrapped: have parameter named $name");
5581 $matches++;
5582 } else {
5583 $this->debug("in parametersMatchWrapped: do not have parameter named $name");
5584 }
5585 $elements++;
5586 }
5587
5588 $this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped parameter names");
5589 if ($matches == 0) {
5590 return false;
5591 }
5592 return true;
5593 }
5594
5595 // since there are no elements for the type, if the user passed no
5596 // parameters, the parameters match wrapped.
5597 $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType");
5598 return count($parameters) == 0;
5599 }
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:195

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

Referenced by serializeRPCParameters().

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

◆ parseWSDL() [1/2]

wsdl::parseWSDL (   $wsdl = '')

parses the wsdl document

Parameters
string$wsdlpath or URL @access private

Definition at line 3290 of file nusoap.php.

3291 {
3292 if ($wsdl == '') {
3293 $this->debug('no wsdl passed to parseWSDL()!!');
3294 $this->setError('no wsdl passed to parseWSDL()!!');
3295 return false;
3296 }
3297
3298 // parse $wsdl for url format
3299 $wsdl_props = parse_url($wsdl);
3300
3301 if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) {
3302 $this->debug('getting WSDL http(s) URL ' . $wsdl);
3303 // get wsdl
3304 $tr = new soap_transport_http($wsdl);
3305 $tr->request_method = 'GET';
3306 $tr->useSOAPAction = false;
3307 if($this->proxyhost && $this->proxyport){
3308 $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
3309 }
3310 if (isset($wsdl_props['user'])) {
3311 $tr->setCredentials($wsdl_props['user'],$wsdl_props['pass']);
3312 }
3313 $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout);
3314 //$this->debug("WSDL request\n" . $tr->outgoing_payload);
3315 //$this->debug("WSDL response\n" . $tr->incoming_payload);
3316 $this->debug("transport debug data...\n" . $tr->debug_str);
3317 // catch errors
3318 if($err = $tr->getError() ){
3319 $errstr = 'HTTP ERROR: '.$err;
3320 $this->debug($errstr);
3321 $this->setError($errstr);
3322 unset($tr);
3323 return false;
3324 }
3325 unset($tr);
3326 } else {
3327 // $wsdl is not http(s), so treat it as a file URL or plain file path
3328 if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) {
3329 $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path'];
3330 } else {
3331 $path = $wsdl;
3332 }
3333 $this->debug('getting WSDL file ' . $path);
3334 if ($fp = @fopen($path, 'r')) {
3335 $wsdl_string = '';
3336 while ($data = fread($fp, 32768)) {
3337 $wsdl_string .= $data;
3338 }
3339 fclose($fp);
3340 } else {
3341 $errstr = "Bad path to WSDL file $path";
3342 $this->debug($errstr);
3343 $this->setError($errstr);
3344 return false;
3345 }
3346 }
3347 // end new code added
3348 // Create an XML parser.
3349 $this->parser = xml_parser_create();
3350 // Set the options for parsing the XML data.
3351 // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
3352 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
3353 // Set the object for the parser.
3354 xml_set_object($this->parser, $this);
3355 // Set the element handlers for the parser.
3356 xml_set_element_handler($this->parser, 'start_element', 'end_element');
3357 xml_set_character_data_handler($this->parser, 'character_data');
3358 // Parse the XML file.
3359 if (!xml_parse($this->parser, $wsdl_string, true)) {
3360 // Display an error message.
3361 $errstr = sprintf(
3362 'XML error parsing WSDL from %s on line %d: %s',
3363 $wsdl,
3364 xml_get_current_line_number($this->parser),
3365 xml_error_string(xml_get_error_code($this->parser))
3366 );
3367 $this->debug($errstr);
3368 $this->debug("XML payload:\n" . $wsdl_string);
3369 $this->setError($errstr);
3370 return false;
3371 }
3372 // free the parser
3373 xml_parser_free($this->parser);
3374 // catch wsdl parse errors
3375 if($this->getError()){
3376 return false;
3377 }
3378 return true;
3379 }
$path
Definition: aliased.php:25
setError($str)
sets error string
Definition: nusoap.php:184
getError()
returns error string if present
Definition: nusoap.php:171
transport class for sending/receiving data via HTTP and HTTPS NOTE: PHP must be compiled with the CUR...
Definition: nusoap.php:1552

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

Referenced by fetchWSDL(), and wsdl().

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

◆ parseWSDL() [2/2]

wsdl::parseWSDL (   $wsdl = '')

parses the wsdl document

Parameters
string$wsdlpath or URL @access private

Definition at line 4691 of file nusoap.php.

4691 {
4692 $this->debug("parse WSDL at path=$wsdl");
4693
4694 if ($wsdl == '') {
4695 $this->debug('no wsdl passed to parseWSDL()!!');
4696 $this->setError('no wsdl passed to parseWSDL()!!');
4697 return false;
4698 }
4699
4700 // parse $wsdl for url format
4701 $wsdl_props = parse_url($wsdl);
4702
4703 if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) {
4704 $this->debug('getting WSDL http(s) URL ' . $wsdl);
4705 // get wsdl
4706 $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl);
4707 $tr->request_method = 'GET';
4708 $tr->useSOAPAction = false;
4709 if($this->proxyhost && $this->proxyport){
4710 $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
4711 }
4712 if ($this->authtype != '') {
4713 $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
4714 }
4715 $tr->setEncoding('gzip, deflate');
4716 $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout);
4717 //$this->debug("WSDL request\n" . $tr->outgoing_payload);
4718 //$this->debug("WSDL response\n" . $tr->incoming_payload);
4719 $this->appendDebug($tr->getDebug());
4720 // catch errors
4721 if($err = $tr->getError() ){
4722 $errstr = 'HTTP ERROR: '.$err;
4723 $this->debug($errstr);
4724 $this->setError($errstr);
4725 unset($tr);
4726 return false;
4727 }
4728 unset($tr);
4729 $this->debug("got WSDL URL");
4730 } else {
4731 // $wsdl is not http(s), so treat it as a file URL or plain file path
4732 if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) {
4733 $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path'];
4734 } else {
4735 $path = $wsdl;
4736 }
4737 $this->debug('getting WSDL file ' . $path);
4738 if ($fp = @fopen($path, 'r')) {
4739 $wsdl_string = '';
4740 while ($data = fread($fp, 32768)) {
4741 $wsdl_string .= $data;
4742 }
4743 fclose($fp);
4744 } else {
4745 $errstr = "Bad path to WSDL file $path";
4746 $this->debug($errstr);
4747 $this->setError($errstr);
4748 return false;
4749 }
4750 }
4751 $this->debug('Parse WSDL');
4752 // end new code added
4753 // Create an XML parser.
4754 $this->parser = xml_parser_create();
4755 // Set the options for parsing the XML data.
4756 // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
4757 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
4758 // Set the object for the parser.
4759 xml_set_object($this->parser, $this);
4760 // Set the element handlers for the parser.
4761 xml_set_element_handler($this->parser, 'start_element', 'end_element');
4762 xml_set_character_data_handler($this->parser, 'character_data');
4763 // Parse the XML file.
4764 if (!xml_parse($this->parser, $wsdl_string, true)) {
4765 // Display an error message.
4766 $errstr = sprintf(
4767 'XML error parsing WSDL from %s on line %d: %s',
4768 $wsdl,
4769 xml_get_current_line_number($this->parser),
4770 xml_error_string(xml_get_error_code($this->parser))
4771 );
4772 $this->debug($errstr);
4773 $this->debug("XML payload:\n" . $wsdl_string);
4774 $this->setError($errstr);
4775 return false;
4776 }
4777 // free the parser
4778 xml_parser_free($this->parser);
4779 $this->debug('Parsing WSDL done');
4780 // catch wsdl parse errors
4781 if($this->getError()){
4782 return false;
4783 }
4784 return true;
4785 }

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

+ Here is the call graph for this function:

◆ serialize() [1/2]

wsdl::serialize (   $debug = 0)

serialize the parsed wsdl

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

Definition at line 5379 of file nusoap.php.

5380 {
5381 $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>';
5382 $xml .= "\n<definitions";
5383 foreach($this->namespaces as $k => $v) {
5384 $xml .= " xmlns:$k=\"$v\"";
5385 }
5386 // 10.9.02 - add poulter fix for wsdl and tns declarations
5387 if (isset($this->namespaces['wsdl'])) {
5388 $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
5389 }
5390 if (isset($this->namespaces['tns'])) {
5391 $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
5392 }
5393 $xml .= '>';
5394 // imports
5395 if (sizeof($this->import) > 0) {
5396 foreach($this->import as $ns => $list) {
5397 foreach ($list as $ii) {
5398 if ($ii['location'] != '') {
5399 $xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />';
5400 } else {
5401 $xml .= '<import namespace="' . $ns . '" />';
5402 }
5403 }
5404 }
5405 }
5406 // types
5407 if (count($this->schemas)>=1) {
5408 $xml .= "\n<types>\n";
5409 foreach ($this->schemas as $ns => $list) {
5410 foreach ($list as $xs) {
5411 $xml .= $xs->serializeSchema();
5412 }
5413 }
5414 $xml .= '</types>';
5415 }
5416 // messages
5417 if (count($this->messages) >= 1) {
5418 foreach($this->messages as $msgName => $msgParts) {
5419 $xml .= "\n<message name=\"" . $msgName . '">';
5420 if(is_array($msgParts)){
5421 foreach($msgParts as $partName => $partType) {
5422 // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>';
5423 if (strpos($partType, ':')) {
5424 $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType));
5425 } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) {
5426 // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>';
5427 $typePrefix = 'xsd';
5428 } else {
5429 foreach($this->typemap as $ns => $types) {
5430 if (isset($types[$partType])) {
5431 $typePrefix = $this->getPrefixFromNamespace($ns);
5432 }
5433 }
5434 if (!isset($typePrefix)) {
5435 die("$partType has no namespace!");
5436 }
5437 }
5438 $ns = $this->getNamespaceFromPrefix($typePrefix);
5439 $localPart = $this->getLocalPart($partType);
5440 $typeDef = $this->getTypeDef($localPart, $ns);
5441 if ($typeDef['typeClass'] == 'element') {
5442 $elementortype = 'element';
5443 if (substr($localPart, -1) == '^') {
5444 $localPart = substr($localPart, 0, -1);
5445 }
5446 } else {
5447 $elementortype = 'type';
5448 }
5449 $xml .= "\n" . ' <part name="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $localPart . '" />';
5450 }
5451 }
5452 $xml .= '</message>';
5453 }
5454 }
5455 // bindings & porttypes
5456 if (count($this->bindings) >= 1) {
5457 $binding_xml = '';
5458 $portType_xml = '';
5459 foreach($this->bindings as $bindingName => $attrs) {
5460 $binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">';
5461 $binding_xml .= "\n" . ' <soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>';
5462 $portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">';
5463 foreach($attrs['operations'] as $opName => $opParts) {
5464 $binding_xml .= "\n" . ' <operation name="' . $opName . '">';
5465 $binding_xml .= "\n" . ' <soap:operation soapAction="' . $opParts['soapAction'] . '" style="'. $opParts['style'] . '"/>';
5466 if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') {
5467 $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"';
5468 } else {
5469 $enc_style = '';
5470 }
5471 $binding_xml .= "\n" . ' <input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>';
5472 if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') {
5473 $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"';
5474 } else {
5475 $enc_style = '';
5476 }
5477 $binding_xml .= "\n" . ' <output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>';
5478 $binding_xml .= "\n" . ' </operation>';
5479 $portType_xml .= "\n" . ' <operation name="' . $opParts['name'] . '"';
5480 if (isset($opParts['parameterOrder'])) {
5481 $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"';
5482 }
5483 $portType_xml .= '>';
5484 if(isset($opParts['documentation']) && $opParts['documentation'] != '') {
5485 $portType_xml .= "\n" . ' <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>';
5486 }
5487 $portType_xml .= "\n" . ' <input message="tns:' . $opParts['input']['message'] . '"/>';
5488 $portType_xml .= "\n" . ' <output message="tns:' . $opParts['output']['message'] . '"/>';
5489 $portType_xml .= "\n" . ' </operation>';
5490 }
5491 $portType_xml .= "\n" . '</portType>';
5492 $binding_xml .= "\n" . '</binding>';
5493 }
5494 $xml .= $portType_xml . $binding_xml;
5495 }
5496 // services
5497 $xml .= "\n<service name=\"" . $this->serviceName . '">';
5498 $has_client = isset($_GET['client_id']);
5499 if (count($this->ports) >= 1) {
5500 foreach($this->ports as $pName => $attrs) {
5501 $xml .= "\n" . ' <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">';
5502 $address = $attrs['location'] . ($debug || $has_client ? "?" : "")
5503 . ($debug ? 'debug=1' : '') . ($debug && $has_client ? "&amp;" : "")
5504 . ($has_client ? 'client_id=' . $_GET['client_id'] : '');
5505 $xml .= "\n" . ' <soap:address location="' . $address. '"/>';
5506 $xml .= "\n" . ' </port>';
5507 }
5508 }
5509
5510 $xml .= "\n" . '</service>';
5511 return $xml . "\n</definitions>";
5512 }
$_GET["client_id"]
getPrefixFromNamespace($ns)
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given...
Definition: nusoap.php:557

References $_GET, Sabre\VObject\$debug, $ii, $list, $xml, nusoap_base\getLocalPart(), nusoap_base\getNamespaceFromPrefix(), nusoap_base\getPrefix(), nusoap_base\getPrefixFromNamespace(), and getTypeDef().

+ Here is the call graph for this function:

◆ serialize() [2/2]

wsdl::serialize ( )

serialize the parsed wsdl

Returns
string , serialization of WSDL @access public

Definition at line 3741 of file nusoap.php.

3742 {
3743 $xml = '<?xml version="1.0" encoding="ISO-8859-1"?><definitions';
3744 foreach($this->namespaces as $k => $v) {
3745 $xml .= " xmlns:$k=\"$v\"";
3746 }
3747 // 10.9.02 - add poulter fix for wsdl and tns declarations
3748 if (isset($this->namespaces['wsdl'])) {
3749 $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
3750 }
3751 if (isset($this->namespaces['tns'])) {
3752 $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
3753 }
3754 $xml .= '>';
3755 // imports
3756 if (sizeof($this->import) > 0) {
3757 foreach($this->import as $ns => $list) {
3758 foreach ($list as $ii) {
3759 if ($ii['location'] != '') {
3760 $xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />';
3761 } else {
3762 $xml .= '<import namespace="' . $ns . '" />';
3763 }
3764 }
3765 }
3766 }
3767 // types
3768 if (count($this->schemas)>=1) {
3769 $xml .= '<types>';
3770 foreach ($this->schemas as $ns => $list) {
3771 foreach ($list as $xs) {
3772 $xml .= $xs->serializeSchema();
3773 }
3774 }
3775 $xml .= '</types>';
3776 }
3777 // messages
3778 if (count($this->messages) >= 1) {
3779 foreach($this->messages as $msgName => $msgParts) {
3780 $xml .= '<message name="' . $msgName . '">';
3781 if(is_array($msgParts)){
3782 foreach($msgParts as $partName => $partType) {
3783 // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>';
3784 if (strpos($partType, ':')) {
3785 $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType));
3786 } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) {
3787 // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>';
3788 $typePrefix = 'xsd';
3789 } else {
3790 foreach($this->typemap as $ns => $types) {
3791 if (isset($types[$partType])) {
3792 $typePrefix = $this->getPrefixFromNamespace($ns);
3793 }
3794 }
3795 if (!isset($typePrefix)) {
3796 die("$partType has no namespace!");
3797 }
3798 }
3799 $xml .= '<part name="' . $partName . '" type="' . $typePrefix . ':' . $this->getLocalPart($partType) . '" />';
3800 }
3801 }
3802 $xml .= '</message>';
3803 }
3804 }
3805 // bindings & porttypes
3806 if (count($this->bindings) >= 1) {
3807 $binding_xml = '';
3808 $portType_xml = '';
3809 foreach($this->bindings as $bindingName => $attrs) {
3810 $binding_xml .= '<binding name="' . $bindingName . '" type="tns:' . $attrs['portType'] . '">';
3811 $binding_xml .= '<soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>';
3812 $portType_xml .= '<portType name="' . $attrs['portType'] . '">';
3813 foreach($attrs['operations'] as $opName => $opParts) {
3814 $binding_xml .= '<operation name="' . $opName . '">';
3815 $binding_xml .= '<soap:operation soapAction="' . $opParts['soapAction'] . '" style="'. $attrs['style'] . '"/>';
3816 if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') {
3817 $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"';
3818 } else {
3819 $enc_style = '';
3820 }
3821 $binding_xml .= '<input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>';
3822 if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') {
3823 $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"';
3824 } else {
3825 $enc_style = '';
3826 }
3827 $binding_xml .= '<output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>';
3828 $binding_xml .= '</operation>';
3829 $portType_xml .= '<operation name="' . $opParts['name'] . '"';
3830 if (isset($opParts['parameterOrder'])) {
3831 $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"';
3832 }
3833 $portType_xml .= '>';
3834 if(isset($opParts['documentation']) && $opParts['documentation'] != '') {
3835 $portType_xml .= '<documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>';
3836 }
3837 $portType_xml .= '<input message="tns:' . $opParts['input']['message'] . '"/>';
3838 $portType_xml .= '<output message="tns:' . $opParts['output']['message'] . '"/>';
3839 $portType_xml .= '</operation>';
3840 }
3841 $portType_xml .= '</portType>';
3842 $binding_xml .= '</binding>';
3843 }
3844 $xml .= $portType_xml . $binding_xml;
3845 }
3846 // services
3847 $xml .= '<service name="' . $this->serviceName . '">';
3848 if (count($this->ports) >= 1) {
3849 foreach($this->ports as $pName => $attrs) {
3850 $xml .= '<port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">';
3851 $xml .= '<soap:address location="' . $attrs['location'] . '"/>';
3852 $xml .= '</port>';
3853 }
3854 }
3855 $xml .= '</service>';
3856 return $xml . '</definitions>';
3857 }

References $ii, $list, $xml, nusoap_base\getLocalPart(), nusoap_base\getPrefix(), and nusoap_base\getPrefixFromNamespace().

Referenced by soap_server\service(), and nusoap_server\service().

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

Definition at line 6093 of file nusoap.php.

6093 {
6094 $xml = '';
6095 if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) {
6096 $this->debug("serialize attributes for XML Schema type $ns:$uqType");
6097 if (is_array($value)) {
6098 $xvalue = $value;
6099 } elseif (is_object($value)) {
6100 $xvalue = get_object_vars($value);
6101 } else {
6102 $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
6103 $xvalue = array();
6104 }
6105 foreach ($typeDef['attrs'] as $aName => $attrs) {
6106 if (isset($xvalue['!' . $aName])) {
6107 $xname = '!' . $aName;
6108 $this->debug("value provided for attribute $aName with key $xname");
6109 } elseif (isset($xvalue[$aName])) {
6110 $xname = $aName;
6111 $this->debug("value provided for attribute $aName with key $xname");
6112 } elseif (isset($attrs['default'])) {
6113 $xname = '!' . $aName;
6114 $xvalue[$xname] = $attrs['default'];
6115 $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName);
6116 } else {
6117 $xname = '';
6118 $this->debug("no value provided for attribute $aName");
6119 }
6120 if ($xname) {
6121 $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
6122 }
6123 }
6124 } else {
6125 $this->debug("no attributes to serialize for XML Schema type $ns:$uqType");
6126 }
6127 if (isset($typeDef['extensionBase'])) {
6128 $ns = $this->getPrefix($typeDef['extensionBase']);
6129 $uqType = $this->getLocalPart($typeDef['extensionBase']);
6130 if ($this->getNamespaceFromPrefix($ns)) {
6131 $ns = $this->getNamespaceFromPrefix($ns);
6132 }
6133 if ($typeDef = $this->getTypeDef($uqType, $ns)) {
6134 $this->debug("serialize attributes for extension base $ns:$uqType");
6135 $xml .= $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
6136 } else {
6137 $this->debug("extension base $ns:$uqType is not a supported type");
6138 }
6139 }
6140 return $xml;
6141 }
expandEntities($val)
expands entities, e.g.
Definition: nusoap.php:154
serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType)
serializes the attributes for a complexType
Definition: nusoap.php:6093

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

Referenced by serializeComplexTypeAttributes(), and serializeType().

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

Definition at line 6155 of file nusoap.php.

6155 {
6156 $xml = '';
6157 if (isset($typeDef['elements']) && is_array($typeDef['elements'])) {
6158 $this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType");
6159 if (is_array($value)) {
6160 $xvalue = $value;
6161 } elseif (is_object($value)) {
6162 $xvalue = get_object_vars($value);
6163 } else {
6164 $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
6165 $xvalue = array();
6166 }
6167 // toggle whether all elements are present - ideally should validate against schema
6168 if (count($typeDef['elements']) != count($xvalue)){
6169 $optionals = true;
6170 }
6171 foreach ($typeDef['elements'] as $eName => $attrs) {
6172 if (!isset($xvalue[$eName])) {
6173 if (isset($attrs['default'])) {
6174 $xvalue[$eName] = $attrs['default'];
6175 $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName);
6176 }
6177 }
6178 // if user took advantage of a minOccurs=0, then only serialize named parameters
6179 if (isset($optionals)
6180 && (!isset($xvalue[$eName]))
6181 && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
6182 ){
6183 if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') {
6184 $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']);
6185 }
6186 // do nothing
6187 $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing");
6188 } else {
6189 // get value
6190 if (isset($xvalue[$eName])) {
6191 $v = $xvalue[$eName];
6192 } else {
6193 $v = null;
6194 }
6195 if (isset($attrs['form'])) {
6196 $unqualified = ($attrs['form'] == 'unqualified');
6197 } else {
6198 $unqualified = false;
6199 }
6200 if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') {
6201 $vv = $v;
6202 foreach ($vv as $k => $v) {
6203 if (isset($attrs['type']) || isset($attrs['ref'])) {
6204 // serialize schema-defined type
6205 $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
6206 } else {
6207 // serialize generic type (can this ever really happen?)
6208 $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
6209 $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
6210 }
6211 }
6212 } else {
6213 if (isset($attrs['type']) || isset($attrs['ref'])) {
6214 // serialize schema-defined type
6215 $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified);
6216 } else {
6217 // serialize generic type (can this ever really happen?)
6218 $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
6219 $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
6220 }
6221 }
6222 }
6223 }
6224 } else {
6225 $this->debug("no elements to serialize for XML Schema type $ns:$uqType");
6226 }
6227 if (isset($typeDef['extensionBase'])) {
6228 $ns = $this->getPrefix($typeDef['extensionBase']);
6229 $uqType = $this->getLocalPart($typeDef['extensionBase']);
6230 if ($this->getNamespaceFromPrefix($ns)) {
6231 $ns = $this->getNamespaceFromPrefix($ns);
6232 }
6233 if ($typeDef = $this->getTypeDef($uqType, $ns)) {
6234 $this->debug("serialize elements for extension base $ns:$uqType");
6235 $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
6236 } else {
6237 $this->debug("extension base $ns:$uqType is not a supported type");
6238 }
6239 }
6240 return $xml;
6241 }
serialize_val($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded')
Definition: nusoap.php:212
serializeType($name, $type, $value, $use='encoded', $encodingStyle=false)
serializes a PHP value according a given type definition
Definition: nusoap.php:4020
serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false)
serializes the elements for a complexType
Definition: nusoap.php:6155

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

Referenced by serializeComplexTypeElements(), and serializeType().

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

◆ serializeParameters() [1/2]

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$ type name
mixed$ param value
Returns
mixed new param or false if initial value didn't validate

Definition at line 3945 of file nusoap.php.

3946 {
3947 $this->debug('in serializeParameters with operation '.$operation.', direction '.$direction.' and '.count($parameters).' param(s), and xml schema version ' . $this->XMLSchemaVersion);
3948
3949 if ($direction != 'input' && $direction != 'output') {
3950 $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
3951 $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
3952 return false;
3953 }
3954 if (!$opData = $this->getOperationData($operation)) {
3955 $this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
3956 $this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
3957 return false;
3958 }
3959 $this->debug($this->varDump($opData));
3960
3961 // Get encoding style for output and set to current
3962 $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
3963 if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
3964 $encodingStyle = $opData['output']['encodingStyle'];
3965 $enc_style = $encodingStyle;
3966 }
3967
3968 // set input params
3969 $xml = '';
3970 if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
3971
3972 $use = $opData[$direction]['use'];
3973 $this->debug("use=$use");
3974 $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
3975 if (is_array($parameters)) {
3976 $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
3977 $this->debug('have ' . $parametersArrayType . ' parameters');
3978 foreach($opData[$direction]['parts'] as $name => $type) {
3979 $this->debug('serializing part "'.$name.'" of type "'.$type.'"');
3980 // Track encoding style
3981 if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
3982 $encodingStyle = $opData[$direction]['encodingStyle'];
3983 $enc_style = $encodingStyle;
3984 } else {
3985 $enc_style = false;
3986 }
3987 // NOTE: add error handling here
3988 // if serializeType returns false, then catch global error and fault
3989 if ($parametersArrayType == 'arraySimple') {
3990 $p = array_shift($parameters);
3991 $this->debug('calling serializeType w/indexed param');
3992 $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
3993 } elseif (isset($parameters[$name])) {
3994 $this->debug('calling serializeType w/named param');
3995 $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
3996 } else {
3997 // TODO: only send nillable
3998 $this->debug('calling serializeType w/null param');
3999 $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
4000 }
4001 }
4002 } else {
4003 $this->debug('no parameters passed.');
4004 }
4005 }
4006 return $xml;
4007 }
getOperationData($operation, $bindingType='soap')
returns an associative array of data necessary for calling an operation
Definition: nusoap.php:3679

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

+ Here is the call graph for this function:

◆ serializeParameters() [2/2]

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

Definition at line 5710 of file nusoap.php.

5711 {
5712 $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion");
5713 $this->appendDebug('parameters=' . $this->varDump($parameters));
5714
5715 if ($direction != 'input' && $direction != 'output') {
5716 $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
5717 $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
5718 return false;
5719 }
5720 if (!$opData = $this->getOperationData($operation)) {
5721 $this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
5722 $this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
5723 return false;
5724 }
5725 $this->debug('opData:');
5726 $this->appendDebug($this->varDump($opData));
5727
5728 // Get encoding style for output and set to current
5729 $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
5730 if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
5731 $encodingStyle = $opData['output']['encodingStyle'];
5732 $enc_style = $encodingStyle;
5733 }
5734
5735 // set input params
5736 $xml = '';
5737 if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
5738
5739 $use = $opData[$direction]['use'];
5740 $this->debug("use=$use");
5741 $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
5742 if (is_array($parameters)) {
5743 $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
5744 $this->debug('have ' . $parametersArrayType . ' parameters');
5745 foreach($opData[$direction]['parts'] as $name => $type) {
5746 $this->debug('serializing part "'.$name.'" of type "'.$type.'"');
5747 // Track encoding style
5748 if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
5749 $encodingStyle = $opData[$direction]['encodingStyle'];
5750 $enc_style = $encodingStyle;
5751 } else {
5752 $enc_style = false;
5753 }
5754 // NOTE: add error handling here
5755 // if serializeType returns false, then catch global error and fault
5756 if ($parametersArrayType == 'arraySimple') {
5757 $p = array_shift($parameters);
5758 $this->debug('calling serializeType w/indexed param');
5759 $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
5760 } elseif (isset($parameters[$name])) {
5761 $this->debug('calling serializeType w/named param');
5762 $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
5763 } else {
5764 // TODO: only send nillable
5765 $this->debug('calling serializeType w/null param');
5766 $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
5767 }
5768 }
5769 } else {
5770 $this->debug('no parameters passed.');
5771 }
5772 }
5773 $this->debug("serializeParameters returning: $xml");
5774 return $xml;
5775 }

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

+ Here is the call graph for this function:

◆ serializeRPCParameters() [1/2]

wsdl::serializeRPCParameters (   $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$ type name
mixed$ param value
Returns
mixed new param or false if initial value didn't validate

Definition at line 3870 of file nusoap.php.

3871 {
3872 $this->debug('in serializeRPCParameters with operation '.$operation.', direction '.$direction.' and '.count($parameters).' param(s), and xml schema version ' . $this->XMLSchemaVersion);
3873
3874 if ($direction != 'input' && $direction != 'output') {
3875 $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
3876 $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
3877 return false;
3878 }
3879 if (!$opData = $this->getOperationData($operation)) {
3880 $this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
3881 $this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
3882 return false;
3883 }
3884 $this->debug($this->varDump($opData));
3885
3886 // Get encoding style for output and set to current
3887 $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
3888 if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
3889 $encodingStyle = $opData['output']['encodingStyle'];
3890 $enc_style = $encodingStyle;
3891 }
3892
3893 // set input params
3894 $xml = '';
3895 if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
3896
3897 $use = $opData[$direction]['use'];
3898 $this->debug("use=$use");
3899 $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
3900 if (is_array($parameters)) {
3901 $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
3902 $this->debug('have ' . $parametersArrayType . ' parameters');
3903 foreach($opData[$direction]['parts'] as $name => $type) {
3904 $this->debug('serializing part "'.$name.'" of type "'.$type.'"');
3905 // Track encoding style
3906 if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
3907 $encodingStyle = $opData[$direction]['encodingStyle'];
3908 $enc_style = $encodingStyle;
3909 } else {
3910 $enc_style = false;
3911 }
3912 // NOTE: add error handling here
3913 // if serializeType returns false, then catch global error and fault
3914 if ($parametersArrayType == 'arraySimple') {
3915 $p = array_shift($parameters);
3916 $this->debug('calling serializeType w/indexed param');
3917 $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
3918 } elseif (isset($parameters[$name])) {
3919 $this->debug('calling serializeType w/named param');
3920 $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
3921 } else {
3922 // TODO: only send nillable
3923 $this->debug('calling serializeType w/null param');
3924 $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
3925 }
3926 }
3927 } else {
3928 $this->debug('no parameters passed.');
3929 }
3930 }
3931 return $xml;
3932 }

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

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

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

◆ serializeRPCParameters() [2/2]

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) @access public

Definition at line 5616 of file nusoap.php.

5616 {
5617 $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType");
5618 $this->appendDebug('parameters=' . $this->varDump($parameters));
5619
5620 if ($direction != 'input' && $direction != 'output') {
5621 $this->debug('The value of the \$direction argument needs to be either "input" or "output"');
5622 $this->setError('The value of the \$direction argument needs to be either "input" or "output"');
5623 return false;
5624 }
5625 if (!$opData = $this->getOperationData($operation, $bindingType)) {
5626 $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
5627 $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
5628 return false;
5629 }
5630 $this->debug('in serializeRPCParameters: opData:');
5631 $this->appendDebug($this->varDump($opData));
5632
5633 // Get encoding style for output and set to current
5634 $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
5635 if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
5636 $encodingStyle = $opData['output']['encodingStyle'];
5637 $enc_style = $encodingStyle;
5638 }
5639
5640 // set input params
5641 $xml = '';
5642 if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) {
5643 $parts = &$opData[$direction]['parts'];
5644 $part_count = sizeof($parts);
5645 $style = $opData['style'];
5646 $use = $opData[$direction]['use'];
5647 $this->debug("have $part_count part(s) to serialize using $style/$use");
5648 if (is_array($parameters)) {
5649 $parametersArrayType = $this->isArraySimpleOrStruct($parameters);
5650 $parameter_count = count($parameters);
5651 $this->debug("have $parameter_count parameter(s) provided as $parametersArrayType to serialize");
5652 // check for Microsoft-style wrapped parameters
5653 if ($style == 'document' && $use == 'literal' && $part_count == 1 && isset($parts['parameters'])) {
5654 $this->debug('check whether the caller has wrapped the parameters');
5655 if ((($parametersArrayType == 'arrayStruct' || $parameter_count == 0) && !isset($parameters['parameters'])) || ($direction == 'output' && $parametersArrayType == 'arraySimple' && $parameter_count == 1)) {
5656 $this->debug('check whether caller\'s parameters match the wrapped ones');
5657 if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) {
5658 $this->debug('wrap the parameters for the caller');
5659 $parameters = array('parameters' => $parameters);
5660 $parameter_count = 1;
5661 }
5662 }
5663 }
5664 foreach ($parts as $name => $type) {
5665 $this->debug("serializing part $name of type $type");
5666 // Track encoding style
5667 if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
5668 $encodingStyle = $opData[$direction]['encodingStyle'];
5669 $enc_style = $encodingStyle;
5670 } else {
5671 $enc_style = false;
5672 }
5673 // NOTE: add error handling here
5674 // if serializeType returns false, then catch global error and fault
5675 if ($parametersArrayType == 'arraySimple') {
5676 $p = array_shift($parameters);
5677 $this->debug('calling serializeType w/indexed param');
5678 $xml .= $this->serializeType($name, $type, $p, $use, $enc_style);
5679 } elseif (isset($parameters[$name])) {
5680 $this->debug('calling serializeType w/named param');
5681 $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style);
5682 } else {
5683 // TODO: only send nillable
5684 $this->debug('calling serializeType w/null param');
5685 $xml .= $this->serializeType($name, $type, null, $use, $enc_style);
5686 }
5687 }
5688 } else {
5689 $this->debug('no parameters passed.');
5690 }
5691 }
5692 $this->debug("serializeRPCParameters returning: $xml");
5693 return $xml;
5694 }
parametersMatchWrapped($type, &$parameters)
determine whether a set of parameters are unwrapped when they are expect to be wrapped,...
Definition: nusoap.php:5523

References $name, $opData, $style, $type, $xml, nusoap_base\appendDebug(), nusoap_base\debug(), getOperationData(), nusoap_base\isArraySimpleOrStruct(), parametersMatchWrapped(), serializeType(), nusoap_base\setError(), and nusoap_base\varDump().

+ Here is the call graph for this function:

◆ serializeType() [1/2]

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

serializes a PHP value according a given type definition

Parameters
string$name,nameof type (part)
string$type,typeof type, heh (type or element)
mixed$value,anative PHP value (parameter value)
string$use,usefor part (encoded|literal)
string$encodingStyle,useto add encoding changes to serialisation
Returns
string serialization @access public

Definition at line 4020 of file nusoap.php.

4021 {
4022 $this->debug("in serializeType: $name, $type, $value, $use, $encodingStyle");
4023 if($use == 'encoded' && $encodingStyle) {
4024 $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"';
4025 }
4026
4027 // if a soap_val has been supplied, let its type override the WSDL
4028 if (is_object($value) && get_class($value) == 'soapval') {
4029 // TODO: get attributes from soapval?
4030 if ($value->type_ns) {
4031 $type = $value->type_ns . ':' . $value->type;
4032 } else {
4033 $type = $value->type;
4034 }
4035 $value = $value->value;
4036 $forceType = true;
4037 $this->debug("in serializeType: soapval overrides type to $type, value to $value");
4038 } else {
4039 $forceType = false;
4040 }
4041
4042 $xml = '';
4043 if (strpos($type, ':')) {
4044 $uqType = substr($type, strrpos($type, ':') + 1);
4045 $ns = substr($type, 0, strrpos($type, ':'));
4046 $this->debug("got a prefixed type: $uqType, $ns");
4047 if ($this->getNamespaceFromPrefix($ns)) {
4048 $ns = $this->getNamespaceFromPrefix($ns);
4049 $this->debug("expanded prefixed type: $uqType, $ns");
4050 }
4051
4052 if($ns == $this->XMLSchemaVersion){
4053
4054 if (is_null($value)) {
4055 if ($use == 'literal') {
4056 // TODO: depends on nillable
4057 return "<$name/>";
4058 } else {
4059 return "<$name xsi:nil=\"true\"/>";
4060 }
4061 }
4062 if ($uqType == 'boolean' && !$value) {
4063 $value = 'false';
4064 } elseif ($uqType == 'boolean') {
4065 $value = 'true';
4066 }
4067 if ($uqType == 'string' && gettype($value) == 'string') {
4068 $value = $this->expandEntities($value);
4069 }
4070 // it's a scalar
4071 // TODO: what about null/nil values?
4072 // check type isn't a custom type extending xmlschema namespace
4073 if (!$this->getTypeDef($uqType, $ns)) {
4074 if ($use == 'literal') {
4075 if ($forceType) {
4076 return "<$name xsi:type=\"" . $this->getPrefixFromNamespace($this->XMLSchemaVersion) . ":$uqType\">$value</$name>";
4077 } else {
4078 return "<$name>$value</$name>";
4079 }
4080 } else {
4081 return "<$name xsi:type=\"" . $this->getPrefixFromNamespace($this->XMLSchemaVersion) . ":$uqType\"$encodingStyle>$value</$name>";
4082 }
4083 }
4084 } else if ($ns == 'http://xml.apache.org/xml-soap') {
4085 if ($uqType == 'Map') {
4086 $contents = '';
4087 foreach($value as $k => $v) {
4088 $this->debug("serializing map element: key $k, value $v");
4089 $contents .= '<item>';
4090 $contents .= $this->serialize_val($k,'key',false,false,false,false,$use);
4091 $contents .= $this->serialize_val($v,'value',false,false,false,false,$use);
4092 $contents .= '</item>';
4093 }
4094 if ($use == 'literal') {
4095 if ($forceType) {
4096 return "<$name xsi:type=\"" . $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap') . ":$uqType\">$contents</$name>";
4097 } else {
4098 return "<$name>$contents</$name>";
4099 }
4100 } else {
4101 return "<$name xsi:type=\"" . $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap') . ":$uqType\"$encodingStyle>$contents</$name>";
4102 }
4103 }
4104 }
4105 } else {
4106 $this->debug("No namespace for type $type");
4107 $ns = '';
4108 $uqType = $type;
4109 }
4110 if(!$typeDef = $this->getTypeDef($uqType, $ns)){
4111 $this->setError("$type ($uqType) is not a supported type.");
4112 $this->debug("$type ($uqType) is not a supported type.");
4113 return false;
4114 } else {
4115 foreach($typeDef as $k => $v) {
4116 $this->debug("typedef, $k: $v");
4117 }
4118 }
4119 $phpType = $typeDef['phpType'];
4120 $this->debug("serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') );
4121 // if php type == struct, map value to the <all> element names
4122 if ($phpType == 'struct') {
4123 if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') {
4124 $elementName = $uqType;
4125 if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
4126 $elementNS = " xmlns=\"$ns\"";
4127 }
4128 } else {
4129 $elementName = $name;
4130 $elementNS = '';
4131 }
4132 if (is_null($value)) {
4133 if ($use == 'literal') {
4134 // TODO: depends on nillable
4135 return "<$elementName$elementNS/>";
4136 } else {
4137 return "<$elementName$elementNS xsi:nil=\"true\"/>";
4138 }
4139 }
4140 if ($use == 'literal') {
4141 if ($forceType) {
4142 $xml = "<$elementName$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">";
4143 } else {
4144 $xml = "<$elementName$elementNS>";
4145 }
4146 } else {
4147 $xml = "<$elementName$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>";
4148 }
4149
4150 if (isset($typeDef['elements']) && is_array($typeDef['elements'])) {
4151 if (is_array($value)) {
4152 $xvalue = $value;
4153 } elseif (is_object($value)) {
4154 $xvalue = get_object_vars($value);
4155 } else {
4156 $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType");
4157 $xvalue = array();
4158 }
4159 // toggle whether all elements are present - ideally should validate against schema
4160 if(count($typeDef['elements']) != count($xvalue)){
4161 $optionals = true;
4162 }
4163 foreach($typeDef['elements'] as $eName => $attrs) {
4164 // if user took advantage of a minOccurs=0, then only serialize named parameters
4165 if(isset($optionals) && !isset($xvalue[$eName])){
4166 // do nothing
4167 } else {
4168 // get value
4169 if (isset($xvalue[$eName])) {
4170 $v = $xvalue[$eName];
4171 } else {
4172 $v = null;
4173 }
4174 // TODO: if maxOccurs > 1 (not just unbounded), then allow serialization of an array
4175 if (isset($attrs['maxOccurs']) && $attrs['maxOccurs'] == 'unbounded' && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') {
4176 $vv = $v;
4177 foreach ($vv as $k => $v) {
4178 if (isset($attrs['type'])) {
4179 // serialize schema-defined type
4180 $xml .= $this->serializeType($eName, $attrs['type'], $v, $use, $encodingStyle);
4181 } else {
4182 // serialize generic type
4183 $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
4184 $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
4185 }
4186 }
4187 } else {
4188 if (isset($attrs['type'])) {
4189 // serialize schema-defined type
4190 $xml .= $this->serializeType($eName, $attrs['type'], $v, $use, $encodingStyle);
4191 } else {
4192 // serialize generic type
4193 $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use");
4194 $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use);
4195 }
4196 }
4197 }
4198 }
4199 } else {
4200 $this->debug("Expected elements for XML Schema type $ns:$uqType");
4201 }
4202 $xml .= "</$elementName>";
4203 } elseif ($phpType == 'array') {
4204 if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
4205 $elementNS = " xmlns=\"$ns\"";
4206 } else {
4207 $elementNS = '';
4208 }
4209 if (is_null($value)) {
4210 if ($use == 'literal') {
4211 // TODO: depends on nillable
4212 return "<$name$elementNS/>";
4213 } else {
4214 return "<$name$elementNS xsi:nil=\"true\"/>";
4215 }
4216 }
4217 if (isset($typeDef['multidimensional'])) {
4218 $nv = array();
4219 foreach($value as $v) {
4220 $cols = ',' . sizeof($v);
4221 $nv = array_merge($nv, $v);
4222 }
4223 $value = $nv;
4224 } else {
4225 $cols = '';
4226 }
4227 if (is_array($value) && sizeof($value) >= 1) {
4228 $rows = sizeof($value);
4229 $contents = '';
4230 foreach($value as $k => $v) {
4231 $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
4232 //if (strpos($typeDef['arrayType'], ':') ) {
4233 if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) {
4234 $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
4235 } else {
4236 $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use);
4237 }
4238 }
4239 $this->debug('contents: '.$this->varDump($contents));
4240 } else {
4241 $rows = 0;
4242 $contents = null;
4243 }
4244 // TODO: for now, an empty value will be serialized as a zero element
4245 // array. Revisit this when coding the handling of null/nil values.
4246 if ($use == 'literal') {
4247 $xml = "<$name$elementNS>"
4248 .$contents
4249 ."</$name>";
4250 } else {
4251 $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '.
4252 $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/')
4253 .':arrayType="'
4254 .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType']))
4255 .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">"
4256 .$contents
4257 ."</$name>";
4258 }
4259 } elseif ($phpType == 'scalar') {
4260 if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
4261 $elementNS = " xmlns=\"$ns\"";
4262 } else {
4263 $elementNS = '';
4264 }
4265 if ($use == 'literal') {
4266 if ($forceType) {
4267 return "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
4268 } else {
4269 return "<$name$elementNS>$value</$name>";
4270 }
4271 } else {
4272 return "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
4273 }
4274 }
4275 $this->debug('returning: '.$this->varDump($xml));
4276 return $xml;
4277 }
$cols
Definition: xhr_table.php:11
$rows
Definition: xhr_table.php:10

References $cols, $name, $rows, $type, $xml, nusoap_base\debug(), nusoap_base\expandEntities(), nusoap_base\getLocalPart(), nusoap_base\getNamespaceFromPrefix(), nusoap_base\getPrefix(), nusoap_base\getPrefixFromNamespace(), getTypeDef(), nusoap_base\isArraySimpleOrStruct(), nusoap_base\serialize_val(), serializeType(), nusoap_base\setError(), and nusoap_base\varDump().

Referenced by serializeComplexTypeElements(), serializeParameters(), serializeRPCParameters(), and serializeType().

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

◆ serializeType() [2/2]

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

Definition at line 5789 of file nusoap.php.

5790 {
5791 $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified"));
5792 $this->appendDebug("value=" . $this->varDump($value));
5793 if($use == 'encoded' && $encodingStyle) {
5794 $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"';
5795 }
5796
5797 // if a soapval has been supplied, let its type override the WSDL
5798 if (is_object($value) && get_class($value) == 'soapval') {
5799 if ($value->type_ns) {
5800 $type = $value->type_ns . ':' . $value->type;
5801 $forceType = true;
5802 $this->debug("in serializeType: soapval overrides type to $type");
5803 } elseif ($value->type) {
5804 $type = $value->type;
5805 $forceType = true;
5806 $this->debug("in serializeType: soapval overrides type to $type");
5807 } else {
5808 $forceType = false;
5809 $this->debug("in serializeType: soapval does not override type");
5810 }
5811 $attrs = $value->attributes;
5812 $value = $value->value;
5813 $this->debug("in serializeType: soapval overrides value to $value");
5814 if ($attrs) {
5815 if (!is_array($value)) {
5816 $value['!'] = $value;
5817 }
5818 foreach ($attrs as $n => $v) {
5819 $value['!' . $n] = $v;
5820 }
5821 $this->debug("in serializeType: soapval provides attributes");
5822 }
5823 } else {
5824 $forceType = false;
5825 }
5826
5827 $xml = '';
5828 if (strpos($type, ':')) {
5829 $uqType = substr($type, strrpos($type, ':') + 1);
5830 $ns = substr($type, 0, strrpos($type, ':'));
5831 $this->debug("in serializeType: got a prefixed type: $uqType, $ns");
5832 if ($this->getNamespaceFromPrefix($ns)) {
5833 $ns = $this->getNamespaceFromPrefix($ns);
5834 $this->debug("in serializeType: expanded prefixed type: $uqType, $ns");
5835 }
5836
5837 if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){
5838 $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type');
5839 if ($unqualified && $use == 'literal') {
5840 $elementNS = " xmlns=\"\"";
5841 } else {
5842 $elementNS = '';
5843 }
5844 if (is_null($value)) {
5845 if ($use == 'literal') {
5846 // TODO: depends on minOccurs
5847 $xml = "<$name$elementNS/>";
5848 } else {
5849 // TODO: depends on nillable, which should be checked before calling this method
5850 $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
5851 }
5852 $this->debug("in serializeType: returning: $xml");
5853 return $xml;
5854 }
5855 if ($uqType == 'Array') {
5856 // JBoss/Axis does this sometimes
5857 return $this->serialize_val($value, $name, false, false, false, false, $use);
5858 }
5859 if ($uqType == 'boolean') {
5860 if ((is_string($value) && $value == 'false') || (! $value)) {
5861 $value = 'false';
5862 } else {
5863 $value = 'true';
5864 }
5865 }
5866 if ($uqType == 'string' && gettype($value) == 'string') {
5867 $value = $this->expandEntities($value);
5868 }
5869 if (($uqType == 'long' || $uqType == 'unsignedLong') && gettype($value) == 'double') {
5870 $value = sprintf("%.0lf", $value);
5871 }
5872 // it's a scalar
5873 // TODO: what about null/nil values?
5874 // check type isn't a custom type extending xmlschema namespace
5875 if (!$this->getTypeDef($uqType, $ns)) {
5876 if ($use == 'literal') {
5877 if ($forceType) {
5878 $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
5879 } else {
5880 $xml = "<$name$elementNS>$value</$name>";
5881 }
5882 } else {
5883 $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
5884 }
5885 $this->debug("in serializeType: returning: $xml");
5886 return $xml;
5887 }
5888 $this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)');
5889 } else if ($ns == 'http://xml.apache.org/xml-soap') {
5890 $this->debug('in serializeType: appears to be Apache SOAP type');
5891 if ($uqType == 'Map') {
5892 $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
5893 if (! $tt_prefix) {
5894 $this->debug('in serializeType: Add namespace for Apache SOAP type');
5895 $tt_prefix = 'ns' . rand(1000, 9999);
5896 $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap';
5897 // force this to be added to usedNamespaces
5898 $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
5899 }
5900 $contents = '';
5901 foreach($value as $k => $v) {
5902 $this->debug("serializing map element: key $k, value $v");
5903 $contents .= '<item>';
5904 $contents .= $this->serialize_val($k,'key',false,false,false,false,$use);
5905 $contents .= $this->serialize_val($v,'value',false,false,false,false,$use);
5906 $contents .= '</item>';
5907 }
5908 if ($use == 'literal') {
5909 if ($forceType) {
5910 $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents</$name>";
5911 } else {
5912 $xml = "<$name>$contents</$name>";
5913 }
5914 } else {
5915 $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents</$name>";
5916 }
5917 $this->debug("in serializeType: returning: $xml");
5918 return $xml;
5919 }
5920 $this->debug('in serializeType: Apache SOAP type, but only support Map');
5921 }
5922 } else {
5923 // TODO: should the type be compared to types in XSD, and the namespace
5924 // set to XSD if the type matches?
5925 $this->debug("in serializeType: No namespace for type $type");
5926 $ns = '';
5927 $uqType = $type;
5928 }
5929 if(!$typeDef = $this->getTypeDef($uqType, $ns)){
5930 $this->setError("$type ($uqType) is not a supported type.");
5931 $this->debug("in serializeType: $type ($uqType) is not a supported type.");
5932 return false;
5933 } else {
5934 $this->debug("in serializeType: found typeDef");
5935 $this->appendDebug('typeDef=' . $this->varDump($typeDef));
5936 if (substr($uqType, -1) == '^') {
5937 $uqType = substr($uqType, 0, -1);
5938 }
5939 }
5940 $phpType = $typeDef['phpType'];
5941 $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') );
5942 // if php type == struct, map value to the <all> element names
5943 if ($phpType == 'struct') {
5944 if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') {
5945 $elementName = $uqType;
5946 if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
5947 $elementNS = " xmlns=\"$ns\"";
5948 } else {
5949 $elementNS = " xmlns=\"\"";
5950 }
5951 } else {
5952 $elementName = $name;
5953 if ($unqualified) {
5954 $elementNS = " xmlns=\"\"";
5955 } else {
5956 $elementNS = '';
5957 }
5958 }
5959 if (is_null($value)) {
5960 if ($use == 'literal') {
5961 // TODO: depends on minOccurs
5962 $xml = "<$elementName$elementNS/>";
5963 } else {
5964 $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
5965 }
5966 $this->debug("in serializeType: returning: $xml");
5967 return $xml;
5968 }
5969 if (is_object($value)) {
5970 $value = get_object_vars($value);
5971 }
5972 if (is_array($value)) {
5973 $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
5974 if ($use == 'literal') {
5975 if ($forceType) {
5976 $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">";
5977 } else {
5978 $xml = "<$elementName$elementNS$elementAttrs>";
5979 }
5980 } else {
5981 $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>";
5982 }
5983
5984 $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle);
5985 $xml .= "</$elementName>";
5986 } else {
5987 $this->debug("in serializeType: phpType is struct, but value is not an array");
5988 $this->setError("phpType is struct, but value is not an array: see debug output for details");
5989 $xml = '';
5990 }
5991 } elseif ($phpType == 'array') {
5992 if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
5993 $elementNS = " xmlns=\"$ns\"";
5994 } else {
5995 if ($unqualified) {
5996 $elementNS = " xmlns=\"\"";
5997 } else {
5998 $elementNS = '';
5999 }
6000 }
6001 if (is_null($value)) {
6002 if ($use == 'literal') {
6003 // TODO: depends on minOccurs
6004 $xml = "<$name$elementNS/>";
6005 } else {
6006 $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" .
6007 $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
6008 ":Array\" " .
6009 $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
6010 ':arrayType="' .
6011 $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) .
6012 ':' .
6013 $this->getLocalPart($typeDef['arrayType'])."[0]\"/>";
6014 }
6015 $this->debug("in serializeType: returning: $xml");
6016 return $xml;
6017 }
6018 if (isset($typeDef['multidimensional'])) {
6019 $nv = array();
6020 foreach($value as $v) {
6021 $cols = ',' . sizeof($v);
6022 $nv = array_merge($nv, $v);
6023 }
6024 $value = $nv;
6025 } else {
6026 $cols = '';
6027 }
6028 if (is_array($value) && sizeof($value) >= 1) {
6029 $rows = sizeof($value);
6030 $contents = '';
6031 foreach($value as $k => $v) {
6032 $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
6033 //if (strpos($typeDef['arrayType'], ':') ) {
6034 if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) {
6035 $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
6036 } else {
6037 $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use);
6038 }
6039 }
6040 } else {
6041 $rows = 0;
6042 $contents = null;
6043 }
6044 // TODO: for now, an empty value will be serialized as a zero element
6045 // array. Revisit this when coding the handling of null/nil values.
6046 if ($use == 'literal') {
6047 $xml = "<$name$elementNS>"
6048 .$contents
6049 ."</$name>";
6050 } else {
6051 $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '.
6052 $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/')
6053 .':arrayType="'
6054 .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType']))
6055 .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">"
6056 .$contents
6057 ."</$name>";
6058 }
6059 } elseif ($phpType == 'scalar') {
6060 if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) {
6061 $elementNS = " xmlns=\"$ns\"";
6062 } else {
6063 if ($unqualified) {
6064 $elementNS = " xmlns=\"\"";
6065 } else {
6066 $elementNS = '';
6067 }
6068 }
6069 if ($use == 'literal') {
6070 if ($forceType) {
6071 $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
6072 } else {
6073 $xml = "<$name$elementNS>$value</$name>";
6074 }
6075 } else {
6076 $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
6077 }
6078 }
6079 $this->debug("in serializeType: returning: $xml");
6080 return $xml;
6081 }

References $cols, $n, $name, $rows, $type, $xml, nusoap_base\appendDebug(), nusoap_base\debug(), nusoap_base\expandEntities(), nusoap_base\getLocalPart(), nusoap_base\getNamespaceFromPrefix(), nusoap_base\getPrefix(), nusoap_base\getPrefixFromNamespace(), getTypeDef(), nusoap_base\serialize_val(), serializeComplexTypeAttributes(), serializeComplexTypeElements(), serializeType(), nusoap_base\setError(), and nusoap_base\varDump().

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

Definition at line 5058 of file nusoap.php.

5058 {
5059 $this->debug("setCredentials username=$username authtype=$authtype certRequest=");
5060 $this->appendDebug($this->varDump($certRequest));
5061 $this->username = $username;
5062 $this->password = $password;
5063 $this->authtype = $authtype;
5064 $this->certRequest = $certRequest;
5065 }
$username
Definition: nusoap.php:4549
$certRequest
Definition: nusoap.php:4552
$password
Definition: nusoap.php:4550
$authtype
Definition: nusoap.php:4551

References $authtype, $certRequest, $password, $username, nusoap_base\appendDebug(), nusoap_base\debug(), and nusoap_base\varDump().

Referenced by nusoap_client\loadWSDL().

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

◆ start_element() [1/2]

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

start-element handler

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

Definition at line 3389 of file nusoap.php.

3390 {
3391 if ($this->status == 'schema') {
3392 $this->currentSchema->schemaStartElement($parser, $name, $attrs);
3393 $this->debug_str .= $this->currentSchema->debug_str;
3394 $this->currentSchema->debug_str = '';
3395 } elseif (ereg('schema$', $name)) {
3396 // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")");
3397 $this->status = 'schema';
3398 $this->currentSchema = new xmlschema('', '', $this->namespaces);
3399 $this->currentSchema->schemaStartElement($parser, $name, $attrs);
3400 $this->debug_str .= $this->currentSchema->debug_str;
3401 $this->currentSchema->debug_str = '';
3402 } else {
3403 // position in the total number of elements, starting from 0
3404 $pos = $this->position++;
3405 $depth = $this->depth++;
3406 // set self as current value for this depth
3407 $this->depth_array[$depth] = $pos;
3408 $this->message[$pos] = array('cdata' => '');
3409 // get element prefix
3410 if (ereg(':', $name)) {
3411 // get ns prefix
3412 $prefix = substr($name, 0, strpos($name, ':'));
3413 // get ns
3414 $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : '';
3415 // get unqualified name
3416 $name = substr(strstr($name, ':'), 1);
3417 }
3418
3419 if (count($attrs) > 0) {
3420 foreach($attrs as $k => $v) {
3421 // if ns declarations, add to class level array of valid namespaces
3422 if (ereg("^xmlns", $k)) {
3423 if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
3424 $this->namespaces[$ns_prefix] = $v;
3425 } else {
3426 $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
3427 }
3428 if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema') {
3429 $this->XMLSchemaVersion = $v;
3430 $this->namespaces['xsi'] = $v . '-instance';
3431 }
3432 } //
3433 // expand each attribute
3434 $k = strpos($k, ':') ? $this->expandQname($k) : $k;
3435 if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') {
3436 $v = strpos($v, ':') ? $this->expandQname($v) : $v;
3437 }
3438 $eAttrs[$k] = $v;
3439 }
3440 $attrs = $eAttrs;
3441 } else {
3442 $attrs = array();
3443 }
3444 // find status, register data
3445 switch ($this->status) {
3446 case 'message':
3447 if ($name == 'part') {
3448 if (isset($attrs['type'])) {
3449 $this->debug("msg " . $this->currentMessage . ": found part $attrs[name]: " . implode(',', $attrs));
3450 $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type'];
3451 }
3452 if (isset($attrs['element'])) {
3453 $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'];
3454 }
3455 }
3456 break;
3457 case 'portType':
3458 switch ($name) {
3459 case 'operation':
3460 $this->currentPortOperation = $attrs['name'];
3461 $this->debug("portType $this->currentPortType operation: $this->currentPortOperation");
3462 if (isset($attrs['parameterOrder'])) {
3463 $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder'];
3464 }
3465 break;
3466 case 'documentation':
3467 $this->documentation = true;
3468 break;
3469 // merge input/output data
3470 default:
3471 $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : '';
3472 $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m;
3473 break;
3474 }
3475 break;
3476 case 'binding':
3477 switch ($name) {
3478 case 'binding':
3479 // get ns prefix
3480 if (isset($attrs['style'])) {
3481 $this->bindings[$this->currentBinding]['prefix'] = $prefix;
3482 }
3483 $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs);
3484 break;
3485 case 'header':
3486 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs;
3487 break;
3488 case 'operation':
3489 if (isset($attrs['soapAction'])) {
3490 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction'];
3491 }
3492 if (isset($attrs['style'])) {
3493 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style'];
3494 }
3495 if (isset($attrs['name'])) {
3496 $this->currentOperation = $attrs['name'];
3497 $this->debug("current binding operation: $this->currentOperation");
3498 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name'];
3499 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding;
3500 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : '';
3501 }
3502 break;
3503 case 'input':
3504 $this->opStatus = 'input';
3505 break;
3506 case 'output':
3507 $this->opStatus = 'output';
3508 break;
3509 case 'body':
3510 if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) {
3511 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs);
3512 } else {
3513 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs;
3514 }
3515 break;
3516 }
3517 break;
3518 case 'service':
3519 switch ($name) {
3520 case 'port':
3521 $this->currentPort = $attrs['name'];
3522 $this->debug('current port: ' . $this->currentPort);
3523 $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']);
3524
3525 break;
3526 case 'address':
3527 $this->ports[$this->currentPort]['location'] = $attrs['location'];
3528 $this->ports[$this->currentPort]['bindingType'] = $namespace;
3529 $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace;
3530 $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location'];
3531 break;
3532 }
3533 break;
3534 }
3535 // set status
3536 switch ($name) {
3537 case 'import':
3538 if (isset($attrs['location'])) {
3539 $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false);
3540 $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')');
3541 } else {
3542 $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
3543 if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
3544 $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
3545 }
3546 $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')');
3547 }
3548 break;
3549 //wait for schema
3550 //case 'types':
3551 // $this->status = 'schema';
3552 // break;
3553 case 'message':
3554 $this->status = 'message';
3555 $this->messages[$attrs['name']] = array();
3556 $this->currentMessage = $attrs['name'];
3557 break;
3558 case 'portType':
3559 $this->status = 'portType';
3560 $this->portTypes[$attrs['name']] = array();
3561 $this->currentPortType = $attrs['name'];
3562 break;
3563 case "binding":
3564 if (isset($attrs['name'])) {
3565 // get binding name
3566 if (strpos($attrs['name'], ':')) {
3567 $this->currentBinding = $this->getLocalPart($attrs['name']);
3568 } else {
3569 $this->currentBinding = $attrs['name'];
3570 }
3571 $this->status = 'binding';
3572 $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']);
3573 $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']);
3574 }
3575 break;
3576 case 'service':
3577 $this->serviceName = $attrs['name'];
3578 $this->status = 'service';
3579 $this->debug('current service: ' . $this->serviceName);
3580 break;
3581 case 'definitions':
3582 foreach ($attrs as $name => $value) {
3583 $this->wsdl_info[$name] = $value;
3584 }
3585 break;
3586 }
3587 }
3588 }
$currentMessage
Definition: nusoap.php:3142
$currentPortType
Definition: nusoap.php:3145
$currentOperation
Definition: nusoap.php:3143
$currentPort
Definition: nusoap.php:3149
$currentBinding
Definition: nusoap.php:3147

References $currentBinding, $currentMessage, $currentOperation, $currentPort, $currentPortType, $depth, $m, $name, $namespace, $parser, nusoap_base\debug(), nusoap_base\expandQname(), nusoap_base\getLocalPart(), and nusoap_base\getPrefixFromNamespace().

+ Here is the call graph for this function:

◆ start_element() [2/2]

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

start-element handler

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

Definition at line 4795 of file nusoap.php.

4796 {
4797 if ($this->status == 'schema') {
4798 $this->currentSchema->schemaStartElement($parser, $name, $attrs);
4799 $this->appendDebug($this->currentSchema->getDebug());
4800 $this->currentSchema->clearDebug();
4801 } elseif (preg_match('/schema$/', $name)) {
4802 $this->debug('Parsing WSDL schema');
4803 // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")");
4804 $this->status = 'schema';
4805 $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces);
4806 $this->currentSchema->schemaStartElement($parser, $name, $attrs);
4807 $this->appendDebug($this->currentSchema->getDebug());
4808 $this->currentSchema->clearDebug();
4809 } else {
4810 // position in the total number of elements, starting from 0
4811 $pos = $this->position++;
4812 $depth = $this->depth++;
4813 // set self as current value for this depth
4814 $this->depth_array[$depth] = $pos;
4815 $this->message[$pos] = array('cdata' => '');
4816 // process attributes
4817 if (count($attrs) > 0) {
4818 // register namespace declarations
4819 foreach($attrs as $k => $v) {
4820 if (preg_match('/^xmlns/',$k)) {
4821 if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
4822 $this->namespaces[$ns_prefix] = $v;
4823 } else {
4824 $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
4825 }
4826 if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
4827 $this->XMLSchemaVersion = $v;
4828 $this->namespaces['xsi'] = $v . '-instance';
4829 }
4830 }
4831 }
4832 // expand each attribute prefix to its namespace
4833 foreach($attrs as $k => $v) {
4834 $k = strpos($k, ':') ? $this->expandQname($k) : $k;
4835 if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') {
4836 $v = strpos($v, ':') ? $this->expandQname($v) : $v;
4837 }
4838 $eAttrs[$k] = $v;
4839 }
4840 $attrs = $eAttrs;
4841 } else {
4842 $attrs = array();
4843 }
4844 // get element prefix, namespace and name
4845 if (preg_match('/:/', $name)) {
4846 // get ns prefix
4847 $prefix = substr($name, 0, strpos($name, ':'));
4848 // get ns
4849 $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : '';
4850 // get unqualified name
4851 $name = substr(strstr($name, ':'), 1);
4852 }
4853 // process attributes, expanding any prefixes to namespaces
4854 // find status, register data
4855 switch ($this->status) {
4856 case 'message':
4857 if ($name == 'part') {
4858 if (isset($attrs['type'])) {
4859 $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs));
4860 $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type'];
4861 }
4862 if (isset($attrs['element'])) {
4863 $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs));
4864 $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^';
4865 }
4866 }
4867 break;
4868 case 'portType':
4869 switch ($name) {
4870 case 'operation':
4871 $this->currentPortOperation = $attrs['name'];
4872 $this->debug("portType $this->currentPortType operation: $this->currentPortOperation");
4873 if (isset($attrs['parameterOrder'])) {
4874 $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder'];
4875 }
4876 break;
4877 case 'documentation':
4878 $this->documentation = true;
4879 break;
4880 // merge input/output data
4881 default:
4882 $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : '';
4883 $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m;
4884 break;
4885 }
4886 break;
4887 case 'binding':
4888 switch ($name) {
4889 case 'binding':
4890 // get ns prefix
4891 if (isset($attrs['style'])) {
4892 $this->bindings[$this->currentBinding]['prefix'] = $prefix;
4893 }
4894 $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs);
4895 break;
4896 case 'header':
4897 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs;
4898 break;
4899 case 'operation':
4900 if (isset($attrs['soapAction'])) {
4901 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction'];
4902 }
4903 if (isset($attrs['style'])) {
4904 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style'];
4905 }
4906 if (isset($attrs['name'])) {
4907 $this->currentOperation = $attrs['name'];
4908 $this->debug("current binding operation: $this->currentOperation");
4909 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name'];
4910 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding;
4911 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : '';
4912 }
4913 break;
4914 case 'input':
4915 $this->opStatus = 'input';
4916 break;
4917 case 'output':
4918 $this->opStatus = 'output';
4919 break;
4920 case 'body':
4921 if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) {
4922 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs);
4923 } else {
4924 $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs;
4925 }
4926 break;
4927 }
4928 break;
4929 case 'service':
4930 switch ($name) {
4931 case 'port':
4932 $this->currentPort = $attrs['name'];
4933 $this->debug('current port: ' . $this->currentPort);
4934 $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']);
4935
4936 break;
4937 case 'address':
4938 $this->ports[$this->currentPort]['location'] = $attrs['location'];
4939 $this->ports[$this->currentPort]['bindingType'] = $namespace;
4940 $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace;
4941 $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location'];
4942 break;
4943 }
4944 break;
4945 }
4946 // set status
4947 switch ($name) {
4948 case 'import':
4949 if (isset($attrs['location'])) {
4950 $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false);
4951 $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')');
4952 } else {
4953 $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
4954 if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
4955 $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
4956 }
4957 $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')');
4958 }
4959 break;
4960 //wait for schema
4961 //case 'types':
4962 // $this->status = 'schema';
4963 // break;
4964 case 'message':
4965 $this->status = 'message';
4966 $this->messages[$attrs['name']] = array();
4967 $this->currentMessage = $attrs['name'];
4968 break;
4969 case 'portType':
4970 $this->status = 'portType';
4971 $this->portTypes[$attrs['name']] = array();
4972 $this->currentPortType = $attrs['name'];
4973 break;
4974 case "binding":
4975 if (isset($attrs['name'])) {
4976 // get binding name
4977 if (strpos($attrs['name'], ':')) {
4978 $this->currentBinding = $this->getLocalPart($attrs['name']);
4979 } else {
4980 $this->currentBinding = $attrs['name'];
4981 }
4982 $this->status = 'binding';
4983 $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']);
4984 $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']);
4985 }
4986 break;
4987 case 'service':
4988 $this->serviceName = $attrs['name'];
4989 $this->status = 'service';
4990 $this->debug('current service: ' . $this->serviceName);
4991 break;
4992 case 'definitions':
4993 foreach ($attrs as $name => $value) {
4994 $this->wsdl_info[$name] = $value;
4995 }
4996 break;
4997 }
4998 }
4999 }
parses an XML Schema, allows access to it's data, other utility methods.
Definition: nusoap.php:1092

References $currentBinding, $currentMessage, $currentOperation, $currentPort, $currentPortType, $depth, $m, $name, $namespace, $parser, nusoap_base\appendDebug(), nusoap_base\debug(), nusoap_base\expandQname(), nusoap_base\getLocalPart(), and nusoap_base\getPrefixFromNamespace().

+ Here is the call graph for this function:

◆ webDescription()

wsdl::webDescription ( )

prints html description of services

@access private

Definition at line 5238 of file nusoap.php.

5238 {
5239 global $HTTP_SERVER_VARS;
5240
5241 if (isset($_SERVER)) {
5242 $PHP_SELF = $_SERVER['PHP_SELF'];
5243 } elseif (isset($HTTP_SERVER_VARS)) {
5244 $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
5245 } else {
5246 $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
5247 }
5248 // begin-patch: https://mantis.ilias.de/view.php?id=28866
5249 $PHP_SELF = filter_var($PHP_SELF, FILTER_SANITIZE_STRING);
5250 // end-patch
5251
5252 $b = '
5253 <html><head><title>NuSOAP: '.$this->serviceName.'</title>
5254 <style type="text/css">
5255 body { font-family: arial; color: #000000; background-color: #ffffff; margin: 0px 0px 0px 0px; }
5256 p { font-family: arial; color: #000000; margin-top: 0px; margin-bottom: 12px; }
5257 pre { background-color: silver; padding: 5px; font-family: Courier New; font-size: x-small; color: #000000;}
5258 ul { margin-top: 10px; margin-left: 20px; }
5259 li { list-style-type: none; margin-top: 10px; color: #000000; }
5260 .content{
5261 margin-left: 0px; padding-bottom: 2em; }
5262 .nav {
5263 padding-top: 10px; padding-bottom: 10px; padding-left: 15px; font-size: .70em;
5264 margin-top: 10px; margin-left: 0px; color: #000000;
5265 background-color: #ccccff; width: 20%; margin-left: 20px; margin-top: 20px; }
5266 .title {
5267 font-family: arial; font-size: 26px; color: #ffffff;
5268 background-color: #999999; width: 105%; margin-left: 0px;
5269 padding-top: 10px; padding-bottom: 10px; padding-left: 15px;}
5270 .hidden {
5271 position: absolute; visibility: hidden; z-index: 200; left: 250px; top: 100px;
5272 font-family: arial; overflow: hidden; width: 600;
5273 padding: 20px; font-size: 10px; background-color: #999999;
5274 layer-background-color:#FFFFFF; }
5275 a,a:active { color: charcoal; font-weight: bold; }
5276 a:visited { color: #666666; font-weight: bold; }
5277 a:hover { color: cc3300; font-weight: bold; }
5278 </style>
5279 <script language="JavaScript" type="text/javascript">
5280 <!--
5281 // POP-UP CAPTIONS...
5282 function lib_bwcheck(){ //Browsercheck (needed)
5283 this.ver=navigator.appVersion
5284 this.agent=navigator.userAgent
5285 this.dom=document.getElementById?1:0
5286 this.opera5=this.agent.indexOf("Opera 5")>-1
5287 this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
5288 this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
5289 this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
5290 this.ie=this.ie4||this.ie5||this.ie6
5291 this.mac=this.agent.indexOf("Mac")>-1
5292 this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
5293 this.ns4=(document.layers && !this.dom)?1:0;
5294 this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
5295 return this
5296 }
5297 var bw = new lib_bwcheck()
5298 //Makes crossbrowser object.
5299 function makeObj(obj){
5300 this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
5301 if(!this.evnt) return false
5302 this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;
5303 this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;
5304 this.writeIt=b_writeIt;
5305 return this
5306 }
5307 // A unit of measure that will be added when setting the position of a layer.
5308 //var px = bw.ns4||window.opera?"":"px";
5309 function b_writeIt(text){
5310 if (bw.ns4){this.wref.write(text);this.wref.close()}
5311 else this.wref.innerHTML = text
5312 }
5313 //Shows the messages
5314 var oDesc;
5315 function popup(divid){
5316 if(oDesc = new makeObj(divid)){
5317 oDesc.css.visibility = "visible"
5318 }
5319 }
5320 function popout(){ // Hides message
5321 if(oDesc) oDesc.css.visibility = "hidden"
5322 }
5323 //-->
5324 </script>
5325 </head>
5326 <body>
5327 <div class=content>
5328 <br><br>
5329 <div class=title>'.$this->serviceName.'</div>
5330 <div class=nav>
5331 <p>View the <a href="'.$PHP_SELF.'?wsdl">WSDL</a> for the service.
5332 Click on an operation name to view it&apos;s details.</p>
5333 <ul>';
5334 foreach($this->getOperations() as $op => $data){
5335 // begin-patch: https://mantis.ilias.de/view.php?id=28866
5336 if (isset($data['endpoint'])) {
5337 $data['endpoint'] = filter_var($data['endpoint'], FILTER_SANITIZE_STRING);
5338 }
5339 // end-patch
5340 $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>";
5341 // create hidden div
5342 $b .= "<div id='$op' class='hidden'>
5343 <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>";
5344 foreach($data as $donnie => $marie){ // loop through opdata
5345 if($donnie == 'input' || $donnie == 'output'){ // show input/output data
5346 $b .= "<font color='white'>".ucfirst($donnie).':</font><br>';
5347 foreach($marie as $captain => $tenille){ // loop through data
5348 if($captain == 'parts'){ // loop thru parts
5349 $b .= "&nbsp;&nbsp;$captain:<br>";
5350 //if(is_array($tenille)){
5351 foreach($tenille as $joanie => $chachi){
5352 $b .= "&nbsp;&nbsp;&nbsp;&nbsp;$joanie: $chachi<br>";
5353 }
5354 //}
5355 } else {
5356 $b .= "&nbsp;&nbsp;$captain: $tenille<br>";
5357 }
5358 }
5359 } else {
5360 $b .= "<font color='white'>".ucfirst($donnie).":</font> $marie<br>";
5361 }
5362 }
5363 $b .= '</div>';
5364 }
5365 $b .= '
5366 <ul>
5367 </div>
5368 </div></body></html>';
5369 return $b;
5370 }
getOperations($bindingType='soap')
returns an assoc array of operation names => operation data
Definition: nusoap.php:3649
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_SERVER, $data, getOperations(), and nusoap_base\setError().

Referenced by nusoap_server\service().

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

◆ wsdl()

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

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 @access public

Definition at line 3181 of file nusoap.php.

3181 {
3182 $this->wsdl = $wsdl;
3183 $this->proxyhost = $proxyhost;
3184 $this->proxyport = $proxyport;
3185 $this->proxyusername = $proxyusername;
3186 $this->proxypassword = $proxypassword;
3187 $this->timeout = $timeout;
3188 $this->response_timeout = $response_timeout;
3189
3190 // parse wsdl file
3191 if ($wsdl != "") {
3192 $this->debug('initial wsdl URL: ' . $wsdl);
3193 $this->parseWSDL($wsdl);
3194 }
3195 // imports
3196 // TODO: handle imports more properly, grabbing them in-line and nesting them
3197 $imported_urls = array();
3198 $imported = 1;
3199 while ($imported > 0) {
3200 $imported = 0;
3201 // Schema imports
3202 foreach ($this->schemas as $ns => $list) {
3203 foreach ($list as $xs) {
3204 $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
3205 foreach ($xs->imports as $ns2 => $list2) {
3206 for ($ii = 0; $ii < count($list2); $ii++) {
3207 if (! $list2[$ii]['loaded']) {
3208 $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
3209 $url = $list2[$ii]['location'];
3210 if ($url != '') {
3211 $urlparts = parse_url($url);
3212 if (!isset($urlparts['host'])) {
3213 $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] .
3214 substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
3215 }
3216 if (! in_array($url, $imported_urls)) {
3217 $this->parseWSDL($url);
3218 $imported++;
3219 $imported_urls[] = $url;
3220 }
3221 } else {
3222 $this->debug("Unexpected scenario: empty URL for unloaded import");
3223 }
3224 }
3225 }
3226 }
3227 }
3228 }
3229 // WSDL imports
3230 $wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
3231 foreach ($this->import as $ns => $list) {
3232 for ($ii = 0; $ii < count($list); $ii++) {
3233 if (! $list[$ii]['loaded']) {
3234 $this->import[$ns][$ii]['loaded'] = true;
3235 $url = $list[$ii]['location'];
3236 if ($url != '') {
3237 $urlparts = parse_url($url);
3238 if (!isset($urlparts['host'])) {
3239 $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] .
3240 substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
3241 }
3242 if (! in_array($url, $imported_urls)) {
3243 $this->parseWSDL($url);
3244 $imported++;
3245 $imported_urls[] = $url;
3246 }
3247 } else {
3248 $this->debug("Unexpected scenario: empty URL for unloaded import");
3249 }
3250 }
3251 }
3252 }
3253 }
3254 // add new data to operation data
3255 foreach($this->bindings as $binding => $bindingData) {
3256 if (isset($bindingData['operations']) && is_array($bindingData['operations'])) {
3257 foreach($bindingData['operations'] as $operation => $data) {
3258 $this->debug('post-parse data gathering for ' . $operation);
3259 $this->bindings[$binding]['operations'][$operation]['input'] =
3260 isset($this->bindings[$binding]['operations'][$operation]['input']) ?
3261 array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) :
3262 $this->portTypes[ $bindingData['portType'] ][$operation]['input'];
3263 $this->bindings[$binding]['operations'][$operation]['output'] =
3264 isset($this->bindings[$binding]['operations'][$operation]['output']) ?
3265 array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) :
3266 $this->portTypes[ $bindingData['portType'] ][$operation]['output'];
3267 if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){
3268 $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ];
3269 }
3270 if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){
3271 $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ];
3272 }
3273 if (isset($bindingData['style'])) {
3274 $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style'];
3275 }
3276 $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : '';
3277 $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : '';
3278 $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : '';
3279 }
3280 }
3281 }
3282 }

References $binding, $data, $ii, $list, $proxyhost, $proxypassword, $proxyport, $proxyusername, $response_timeout, $timeout, $url, $wsdl, nusoap_base\debug(), and parseWSDL().

Referenced by nusoap_client\__construct(), nusoap_server\__construct(), soap_client\soap_client(), and soap_server\soap_server().

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

Field Documentation

◆ $authtype

wsdl::$authtype = ''

Definition at line 4551 of file nusoap.php.

Referenced by setCredentials().

◆ $bindings

wsdl::$bindings = array()

Definition at line 3146 of file nusoap.php.

◆ $certRequest

wsdl::$certRequest = array()

Definition at line 4552 of file nusoap.php.

Referenced by setCredentials().

◆ $complexTypes

wsdl::$complexTypes = array()

Definition at line 3140 of file nusoap.php.

◆ $curl_options

wsdl::$curl_options = array()

Definition at line 4546 of file nusoap.php.

Referenced by __construct().

◆ $currentBinding

wsdl::$currentBinding

Definition at line 3147 of file nusoap.php.

Referenced by start_element().

◆ $currentMessage

wsdl::$currentMessage

Definition at line 3142 of file nusoap.php.

Referenced by start_element().

◆ $currentOperation

wsdl::$currentOperation

Definition at line 3143 of file nusoap.php.

Referenced by start_element().

◆ $currentPort

wsdl::$currentPort

Definition at line 3149 of file nusoap.php.

Referenced by start_element().

◆ $currentPortType

wsdl::$currentPortType

Definition at line 3145 of file nusoap.php.

Referenced by start_element().

◆ $currentSchema

wsdl::$currentSchema

Definition at line 3138 of file nusoap.php.

Referenced by end_element().

◆ $depth

wsdl::$depth = 0

Definition at line 3159 of file nusoap.php.

Referenced by character_data(), and start_element().

◆ $depth_array

wsdl::$depth_array = array()

Definition at line 3160 of file nusoap.php.

◆ $documentation

wsdl::$documentation = false

Definition at line 3152 of file nusoap.php.

Referenced by addOperation().

◆ $endpoint

wsdl::$endpoint = ''

Definition at line 3153 of file nusoap.php.

◆ $import

wsdl::$import = array()

Definition at line 3155 of file nusoap.php.

◆ $message

wsdl::$message = array()

Definition at line 3139 of file nusoap.php.

◆ $messages

wsdl::$messages = array()

Definition at line 3141 of file nusoap.php.

◆ $opData

wsdl::$opData = array()

◆ $parser

wsdl::$parser

Definition at line 3157 of file nusoap.php.

Referenced by end_element(), and start_element().

◆ $password

wsdl::$password = ''

Definition at line 4550 of file nusoap.php.

Referenced by setCredentials().

◆ $ports

wsdl::$ports = array()

Definition at line 3148 of file nusoap.php.

◆ $portTypes

wsdl::$portTypes = array()

Definition at line 3144 of file nusoap.php.

◆ $position

wsdl::$position = 0

Definition at line 3158 of file nusoap.php.

◆ $proxyhost

wsdl::$proxyhost = ''

Definition at line 3162 of file nusoap.php.

Referenced by __construct(), and wsdl().

◆ $proxypassword

wsdl::$proxypassword = ''

Definition at line 3165 of file nusoap.php.

Referenced by __construct(), and wsdl().

◆ $proxyport

wsdl::$proxyport = ''

Definition at line 3163 of file nusoap.php.

Referenced by __construct(), and wsdl().

◆ $proxyusername

wsdl::$proxyusername = ''

Definition at line 3164 of file nusoap.php.

Referenced by __construct(), and wsdl().

◆ $response_timeout

wsdl::$response_timeout = 30

Definition at line 3167 of file nusoap.php.

Referenced by __construct(), and wsdl().

◆ $schemas

wsdl::$schemas = array()

Definition at line 3137 of file nusoap.php.

◆ $status

wsdl::$status = ''

Definition at line 3151 of file nusoap.php.

◆ $timeout

wsdl::$timeout = 0

Definition at line 3166 of file nusoap.php.

Referenced by __construct(), and wsdl().

◆ $use_curl

wsdl::$use_curl = false

Definition at line 4547 of file nusoap.php.

Referenced by __construct().

◆ $username

wsdl::$username = ''

Definition at line 4549 of file nusoap.php.

Referenced by setCredentials().

◆ $wsdl

wsdl::$wsdl

Definition at line 3135 of file nusoap.php.

Referenced by fetchWSDL(), parseWSDL(), and wsdl().


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