ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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:80
expandQname($qname)
expands a qualified name
Definition: nusoap.php:483

References $n, 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 6244 of file nusoap.php.

6244 {
6245 if (count($elements) > 0) {
6246 $eElements = array();
6247 foreach($elements as $n => $e){
6248 // expand each element
6249 $ee = array();
6250 foreach ($e as $k => $v) {
6251 $k = strpos($k,':') ? $this->expandQname($k) : $k;
6252 $v = strpos($v,':') ? $this->expandQname($v) : $v;
6253 $ee[$k] = $v;
6254 }
6255 $eElements[$n] = $ee;
6256 }
6257 $elements = $eElements;
6258 }
6259
6260 if (count($attrs) > 0) {
6261 foreach($attrs as $n => $a){
6262 // expand each attribute
6263 foreach ($a as $k => $v) {
6264 $k = strpos($k,':') ? $this->expandQname($k) : $k;
6265 $v = strpos($v,':') ? $this->expandQname($v) : $v;
6266 $aa[$k] = $v;
6267 }
6268 $eAttrs[$n] = $aa;
6269 }
6270 $attrs = $eAttrs;
6271 }
6272
6273 $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
6274 $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType;
6275
6276 $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6277 $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType);
6278 }

References $n, 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 6305 of file nusoap.php.

6305 {
6306 $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6307 $this->schemas[$typens][0]->addElement($attrs);
6308 }

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, $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 6324 of file nusoap.php.

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

6291 {
6292 $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
6293
6294 $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
6295 $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration);
6296 }

References 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

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, 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, $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
$url
Definition: shib_logout.php:72

References $data, $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 }

◆ 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 }

◆ 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 }

References $t.

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

References $t, 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 5510 of file nusoap.php.

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

References 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 }
sprintf('%.4f', $callTime)
$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(), nusoap_base\setError(), and sprintf.

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(), nusoap_base\setError(), and sprintf.

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

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

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

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

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

References 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 $opData, 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 5697 of file nusoap.php.

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

References $opData, 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 $opData, 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 5603 of file nusoap.php.

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

References $opData, $style, 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 }

References $contents, 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 5776 of file nusoap.php.

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

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