ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
nusoap_base Class Reference

nusoap_base More...

+ Inheritance diagram for nusoap_base:
+ Collaboration diagram for nusoap_base:

Public Member Functions

 __construct ()
 constructor More...
 
 getGlobalDebugLevel ()
 gets the global debug level, which applies to future instances More...
 
 setGlobalDebugLevel ($level)
 sets the global debug level, which applies to future instances More...
 
 getDebugLevel ()
 gets the debug level for this instance More...
 
 setDebugLevel ($level)
 sets the debug level for this instance More...
 
 debug ($string)
 adds debug data to the instance debug string with formatting More...
 
 appendDebug ($string)
 adds debug data to the instance debug string without formatting More...
 
 clearDebug ()
 clears the current debug data for this instance More...
 
getDebug ()
 gets the current debug data for this instance More...
 
getDebugAsXMLComment ()
 gets the current debug data for this instance as an XML comment this may change the contents of the debug data More...
 
 expandEntities ($val)
 expands entities, e.g. More...
 
 getError ()
 returns error string if present More...
 
 setError ($str)
 sets error string More...
 
 isArraySimpleOrStruct ($val)
 detect if array is a simple array or a struct (associative array) More...
 
 serialize_val ($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded', $soapval=false)
 serializes PHP values in accordance w/ section 5. More...
 
 serializeEnvelope ($body, $headers=false, $namespaces=array(), $style='rpc', $use='encoded', $encodingStyle='http://schemas.xmlsoap.org/soap/encoding/')
 serializes a message More...
 
 formatDump ($str)
 formats a string to be inserted into an HTML stream More...
 
 contractQname ($qname)
 contracts (changes namespace to prefix) a qualified name More...
 
 expandQname ($qname)
 expands (changes prefix to namespace) a qualified name More...
 
 getLocalPart ($str)
 returns the local part of a prefixed string returns the original string, if not prefixed More...
 
 getPrefix ($str)
 returns the prefix part of a prefixed string returns false, if not prefixed More...
 
 getNamespaceFromPrefix ($prefix)
 pass it a prefix, it returns a namespace More...
 
 getPrefixFromNamespace ($ns)
 returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace More...
 
 getmicrotime ()
 returns the time in ODBC canonical form with microseconds More...
 
 varDump ($data)
 Returns a string with the output of var_dump. More...
 
 __toString ()
 represents the object as a string More...
 

Data Fields

 $title = 'NuSOAP'
 
 $version = '0.7.3'
 
 $revision = '$Revision$'
 
 $error_str = ''
 
 $debug_str = ''
 
 $charencoding = true
 
 $debugLevel
 
 $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'
 
 $soap_defencoding = 'UTF-8'
 
 $namespaces
 
 $usedNamespaces = array()
 
 $typemap
 
 $xmlEntities
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

nusoap_base::__construct ( )

constructor

@access public

Definition at line 195 of file nusoap.php.

196 {
197 $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
198 }
$GLOBALS["DIC"]
Definition: wac.php:54

References $GLOBALS.

Member Function Documentation

◆ __toString()

nusoap_base::__toString ( )

represents the object as a string

Returns
string @access public

Definition at line 882 of file nusoap.php.

883 {
884 return $this->varDump($this);
885 }
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:867

References varDump().

+ Here is the call graph for this function:

◆ appendDebug()

◆ clearDebug()

nusoap_base::clearDebug ( )

clears the current debug data for this instance

@access public

Definition at line 277 of file nusoap.php.

278 {
279 // it would be nice to use a memory stream here to use
280 // memory more efficiently
281 $this->debug_str = '';
282 }

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

+ Here is the caller graph for this function:

◆ contractQname()

nusoap_base::contractQname (   $qname)

contracts (changes namespace to prefix) a qualified name

Parameters
string$qnameqname
Returns
string contracted qname @access private

Definition at line 727 of file nusoap.php.

728 {
729 // get element namespace
730 //$this->xdebug("Contract $qname");
731 if (strrpos($qname, ':')) {
732 // get unqualified name
733 $name = substr($qname, strrpos($qname, ':') + 1);
734 // get ns
735 $ns = substr($qname, 0, strrpos($qname, ':'));
736 $p = $this->getPrefixFromNamespace($ns);
737 if ($p) {
738 return $p . ':' . $name;
739 }
740 return $qname;
741 } else {
742 return $qname;
743 }
744 }
getPrefixFromNamespace($ns)
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given...
Definition: nusoap.php:830

References getPrefixFromNamespace().

+ Here is the call graph for this function:

◆ debug()

nusoap_base::debug (   $string)

adds debug data to the instance debug string with formatting

Parameters
string$stringdebug data @access private

Definition at line 250 of file nusoap.php.

251 {
252 if ($this->debugLevel > 0) {
253 $this->appendDebug($this->getmicrotime() . ' ' . get_class($this) . ": $string\n");
254 }
255 }
getmicrotime()
returns the time in ODBC canonical form with microseconds
Definition: nusoap.php:847
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:263

References appendDebug(), and getmicrotime().

Referenced by nusoap_client\__construct(), nusoap_xmlschema\__construct(), soap_transport_http\__construct(), wsdl\__construct(), nusoap_server\__construct(), nusoap_parser\__construct(), nusoap_client\_getProxyClassCode(), soap_transport_http\buildPayload(), nusoap_parser\buildVal(), nusoap_client\call(), nusoap_client\checkCookies(), nusoap_client\checkWSDL(), soap_transport_http\connect(), soap_transport_http\decodeChunked(), nusoap_parser\decodeSimple(), wsdl\end_element(), wsdl\fetchWSDL(), soap_transport_http\getCookiesForRequest(), nusoap_client\getOperationData(), nusoap_client\getProxy(), soap_transport_http\getResponse(), wsdl\getTypeDef(), nusoap_server\invoke_method(), nusoap_client\loadWSDL(), wsdl\parametersMatchWrapped(), nusoap_server\parse_http_headers(), nusoap_server\parse_request(), nusoap_xmlschema\parseFile(), nusoap_server\parseRequest(), nusoap_client\parseResponse(), nusoap_xmlschema\parseString(), wsdl\parseWSDL(), soap_transport_http\send(), nusoap_client\send(), nusoap_server\send_response(), soap_transport_http\sendRequest(), nusoap_server\serialize_return(), serialize_val(), wsdl\serializeComplexTypeAttributes(), wsdl\serializeComplexTypeElements(), serializeEnvelope(), wsdl\serializeParameters(), wsdl\serializeRPCParameters(), wsdl\serializeType(), nusoap_server\service(), wsdl\setCredentials(), nusoap_client\setCredentials(), soap_transport_http\setCredentials(), soap_transport_http\setCurlOption(), nusoap_client\setCurlOption(), nusoap_client\setEndpoint(), soap_transport_http\setHeader(), nusoap_client\setHeaders(), nusoap_client\setHTTPEncoding(), soap_transport_http\setProxy(), soap_transport_http\setURL(), nusoap_client\setUseCURL(), wsdl\start_element(), nusoap_parser\start_element(), soap_transport_http\unsetHeader(), nusoap_client\UpdateCookies(), nusoap_client\useHTTPPersistentConnection(), and nusoap_xmlschema\xdebug().

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

◆ expandEntities()

nusoap_base::expandEntities (   $val)

expands entities, e.g.

changes '<' to '<'.

Parameters
string$valThe string in which to expand entities. @access private

Definition at line 321 of file nusoap.php.

322 {
323 if ($this->charencoding) {
324 $val = str_replace('&', '&amp;', $val);
325 $val = str_replace("'", '&apos;', $val);
326 $val = str_replace('"', '&quot;', $val);
327 $val = str_replace('<', '&lt;', $val);
328 $val = str_replace('>', '&gt;', $val);
329 }
330 return $val;
331 }

Referenced by serialize_val(), wsdl\serializeComplexTypeAttributes(), and wsdl\serializeType().

+ Here is the caller graph for this function:

◆ expandQname()

nusoap_base::expandQname (   $qname)

expands (changes prefix to namespace) a qualified name

Parameters
string$qnameqname
Returns
string expanded qname @access private

Definition at line 753 of file nusoap.php.

754 {
755 // get element prefix
756 if (strpos($qname, ':') && !preg_match('/^http:\/\//', $qname)) {
757 // get unqualified name
758 $name = substr(strstr($qname, ':'), 1);
759 // get ns prefix
760 $prefix = substr($qname, 0, strpos($qname, ':'));
761 if (isset($this->namespaces[$prefix])) {
762 return $this->namespaces[$prefix] . ':' . $name;
763 } else {
764 return $qname;
765 }
766 } else {
767 return $qname;
768 }
769 }

Referenced by wsdl\addComplexType(), wsdl\addSimpleType(), nusoap_xmlschema\schemaStartElement(), and wsdl\start_element().

+ Here is the caller graph for this function:

◆ formatDump()

nusoap_base::formatDump (   $str)

formats a string to be inserted into an HTML stream

Parameters
string$strThe string to format
Returns
string The formatted string @access public
Deprecated:

Definition at line 714 of file nusoap.php.

715 {
716 $str = htmlspecialchars($str);
717 return nl2br($str);
718 }

◆ getDebug()

& nusoap_base::getDebug ( )

gets the current debug data for this instance

Returns
debug data @access public

Definition at line 290 of file nusoap.php.

291 {
292 // it would be nice to use a memory stream here to use
293 // memory more efficiently
294 return $this->debug_str;
295 }

References $debug_str.

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

+ Here is the caller graph for this function:

◆ getDebugAsXMLComment()

& nusoap_base::getDebugAsXMLComment ( )

gets the current debug data for this instance as an XML comment this may change the contents of the debug data

Returns
debug data as an XML comment @access public

Definition at line 304 of file nusoap.php.

305 {
306 // it would be nice to use a memory stream here to use
307 // memory more efficiently
308 while (strpos($this->debug_str, '--')) {
309 $this->debug_str = str_replace('--', '- -', $this->debug_str);
310 }
311 $ret = "<!--\n" . $this->debug_str . "\n-->";
312 return $ret;
313 }

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

+ Here is the caller graph for this function:

◆ getDebugLevel()

nusoap_base::getDebugLevel ( )

gets the debug level for this instance

Returns
int Debug level 0-9, where 0 turns off @access public

Definition at line 228 of file nusoap.php.

229 {
230 return $this->debugLevel;
231 }

References $debugLevel.

◆ getError()

nusoap_base::getError ( )

returns error string if present

Returns
mixed error string or false @access public

Definition at line 339 of file nusoap.php.

340 {
341 if ($this->error_str != '') {
342 return $this->error_str;
343 }
344 return false;
345 }

References $error_str.

Referenced by nusoap_server\__construct(), nusoap_client\_getProxyClassCode(), nusoap_client\call(), nusoap_client\checkWSDL(), nusoap_client\getOperationData(), nusoap_client\getProxy(), wsdl\parseWSDL(), nusoap_client\send(), and nusoap_server\serialize_return().

+ Here is the caller graph for this function:

◆ getGlobalDebugLevel()

nusoap_base::getGlobalDebugLevel ( )

gets the global debug level, which applies to future instances

Returns
integer Debug level 0-9, where 0 turns off @access public

Definition at line 206 of file nusoap.php.

207 {
208 return $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
209 }

References $GLOBALS.

◆ getLocalPart()

nusoap_base::getLocalPart (   $str)

returns the local part of a prefixed string returns the original string, if not prefixed

Parameters
string$strThe prefixed string
Returns
string The local part @access public

Definition at line 779 of file nusoap.php.

780 {
781 if ($sstr = strrchr($str, ':')) {
782 // get unqualified name
783 return substr($sstr, 1);
784 } else {
785 return $str;
786 }
787 }

Referenced by wsdl\addOperation(), nusoap_xmlschema\schemaEndElement(), nusoap_xmlschema\schemaStartElement(), wsdl\serialize(), wsdl\serializeComplexTypeAttributes(), wsdl\serializeComplexTypeElements(), wsdl\serializeType(), wsdl\start_element(), nusoap_parser\start_element(), and nusoap_xmlschema\typeToForm().

+ Here is the caller graph for this function:

◆ getmicrotime()

nusoap_base::getmicrotime ( )

returns the time in ODBC canonical form with microseconds

Returns
string The time in ODBC canonical form with microseconds @access public

Definition at line 847 of file nusoap.php.

848 {
849 if (function_exists('gettimeofday')) {
850 $tod = gettimeofday();
851 $sec = $tod['sec'];
852 $usec = $tod['usec'];
853 } else {
854 $sec = time();
855 $usec = 0;
856 }
857 return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec);
858 }

Referenced by debug().

+ Here is the caller graph for this function:

◆ getNamespaceFromPrefix()

nusoap_base::getNamespaceFromPrefix (   $prefix)

pass it a prefix, it returns a namespace

Parameters
string$prefixThe prefix
Returns
mixed The namespace, false if no namespace has the specified prefix @access public

Definition at line 813 of file nusoap.php.

814 {
815 if (isset($this->namespaces[$prefix])) {
816 return $this->namespaces[$prefix];
817 }
818 //$this->setError("No namespace registered for prefix '$prefix'");
819 return false;
820 }

Referenced by wsdl\addOperation(), wsdl\parametersMatchWrapped(), nusoap_xmlschema\schemaStartElement(), wsdl\serialize(), wsdl\serializeComplexTypeAttributes(), wsdl\serializeComplexTypeElements(), and wsdl\serializeType().

+ Here is the caller graph for this function:

◆ getPrefix()

nusoap_base::getPrefix (   $str)

returns the prefix part of a prefixed string returns false, if not prefixed

Parameters
string$strThe prefixed string
Returns
mixed The prefix or false if there is no prefix @access public

Definition at line 797 of file nusoap.php.

798 {
799 if ($pos = strrpos($str, ':')) {
800 // get prefix
801 return substr($str, 0, $pos);
802 }
803 return false;
804 }

Referenced by nusoap_xmlschema\addElement(), wsdl\addOperation(), nusoap_xmlschema\schemaEndElement(), nusoap_xmlschema\schemaStartElement(), wsdl\serialize(), wsdl\serializeComplexTypeAttributes(), wsdl\serializeComplexTypeElements(), wsdl\serializeType(), and nusoap_parser\start_element().

+ Here is the caller graph for this function:

◆ getPrefixFromNamespace()

nusoap_base::getPrefixFromNamespace (   $ns)

returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given namespace

Parameters
string$nsThe namespace
Returns
mixed The prefix, false if the namespace has no prefixes @access public

Definition at line 830 of file nusoap.php.

831 {
832 foreach ($this->namespaces as $p => $n) {
833 if ($ns == $n || $ns == $p) {
834 $this->usedNamespaces[$p] = $n;
835 return $p;
836 }
837 }
838 return false;
839 }

Referenced by nusoap_client\call(), contractQname(), nusoap_xmlschema\schemaStartElement(), wsdl\serialize(), nusoap_xmlschema\serializeSchema(), wsdl\serializeType(), and wsdl\start_element().

+ Here is the caller graph for this function:

◆ isArraySimpleOrStruct()

nusoap_base::isArraySimpleOrStruct (   $val)

detect if array is a simple array or a struct (associative array)

Parameters
mixed$valThe PHP array
Returns
string (arraySimple|arrayStruct) @access private

Definition at line 365 of file nusoap.php.

366 {
367 $keyList = array_keys($val);
368 foreach ($keyList as $keyListValue) {
369 if (!is_int($keyListValue)) {
370 return 'arrayStruct';
371 }
372 }
373 return 'arraySimple';
374 }

Referenced by wsdl\parametersMatchWrapped(), serialize_val(), wsdl\serializeComplexTypeElements(), wsdl\serializeParameters(), and wsdl\serializeRPCParameters().

+ Here is the caller graph for this function:

◆ serialize_val()

nusoap_base::serialize_val (   $val,
  $name = false,
  $type = false,
  $name_ns = false,
  $type_ns = false,
  $attributes = false,
  $use = 'encoded',
  $soapval = false 
)

serializes PHP values in accordance w/ section 5.

Type information is not serialized if $use == 'literal'.

Parameters
mixed$valThe value to serialize
string$nameThe name (local part) of the XML element
string$typeThe XML schema type (local part) for the element
string$name_nsThe namespace for the name of the XML element
string$type_nsThe namespace for the type of the element
array$attributesThe attributes to serialize as name=>value pairs
string$useThe WSDL "use" (encoded|literal)
boolean$soapvalWhether this is called from soapval.
Returns
string The serialized element, possibly with child elements @access public

Definition at line 391 of file nusoap.php.

392 {
393 $this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval");
394 $this->appendDebug('value=' . $this->varDump($val));
395 $this->appendDebug('attributes=' . $this->varDump($attributes));
396
397 if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) {
398 $this->debug("serialize_val: serialize soapval");
399 $xml = $val->serialize($use);
400 $this->appendDebug($val->getDebug());
401 $val->clearDebug();
402 $this->debug("serialize_val of soapval returning $xml");
403 return $xml;
404 }
405 // force valid name if necessary
406 if (is_numeric($name)) {
407 $name = '__numeric_' . $name;
408 } elseif (! $name) {
409 $name = 'noname';
410 }
411 // if name has ns, add ns prefix to name
412 $xmlns = '';
413 if ($name_ns) {
414 $prefix = 'nu' . rand(1000, 9999);
415 $name = $prefix . ':' . $name;
416 $xmlns .= " xmlns:$prefix=\"$name_ns\"";
417 }
418 // if type is prefixed, create type prefix
419 if ($type_ns != '' && $type_ns == $this->namespaces['xsd']) {
420 // need to fix this. shouldn't default to xsd if no ns specified
421 // w/o checking against typemap
422 $type_prefix = 'xsd';
423 } elseif ($type_ns) {
424 $type_prefix = 'ns' . rand(1000, 9999);
425 $xmlns .= " xmlns:$type_prefix=\"$type_ns\"";
426 }
427 // serialize attributes if present
428 $atts = '';
429 if ($attributes) {
430 foreach ($attributes as $k => $v) {
431 $atts .= " $k=\"" . $this->expandEntities($v) . '"';
432 }
433 }
434 // serialize null value
435 if (is_null($val)) {
436 $this->debug("serialize_val: serialize null");
437 if ($use == 'literal') {
438 // TODO: depends on minOccurs
439 $xml = "<$name$xmlns$atts/>";
440 $this->debug("serialize_val returning $xml");
441 return $xml;
442 } else {
443 if (isset($type) && isset($type_prefix)) {
444 $type_str = " xsi:type=\"$type_prefix:$type\"";
445 } else {
446 $type_str = '';
447 }
448 $xml = "<$name$xmlns$type_str$atts xsi:nil=\"true\"/>";
449 $this->debug("serialize_val returning $xml");
450 return $xml;
451 }
452 }
453 // serialize if an xsd built-in primitive type
454 if ($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])) {
455 $this->debug("serialize_val: serialize xsd built-in primitive type");
456 if (is_bool($val)) {
457 if ($type == 'boolean') {
458 $val = $val ? 'true' : 'false';
459 } elseif (! $val) {
460 $val = 0;
461 }
462 } elseif (is_string($val)) {
463 $val = $this->expandEntities($val);
464 }
465 if ($use == 'literal') {
466 $xml = "<$name$xmlns$atts>$val</$name>";
467 $this->debug("serialize_val returning $xml");
468 return $xml;
469 } else {
470 $xml = "<$name$xmlns xsi:type=\"xsd:$type\"$atts>$val</$name>";
471 $this->debug("serialize_val returning $xml");
472 return $xml;
473 }
474 }
475 // detect type and serialize
476 $xml = '';
477 switch (true) {
478 case (is_bool($val) || $type == 'boolean'):
479 $this->debug("serialize_val: serialize boolean");
480 if ($type == 'boolean') {
481 $val = $val ? 'true' : 'false';
482 } elseif (! $val) {
483 $val = 0;
484 }
485 if ($use == 'literal') {
486 $xml .= "<$name$xmlns$atts>$val</$name>";
487 } else {
488 $xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val</$name>";
489 }
490 break;
491 case (is_int($val) || is_long($val) || $type == 'int'):
492 $this->debug("serialize_val: serialize int");
493 if ($use == 'literal') {
494 $xml .= "<$name$xmlns$atts>$val</$name>";
495 } else {
496 $xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
497 }
498 break;
499 case (is_float($val) || is_double($val) || $type == 'float'):
500 $this->debug("serialize_val: serialize float");
501 if ($use == 'literal') {
502 $xml .= "<$name$xmlns$atts>$val</$name>";
503 } else {
504 $xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val</$name>";
505 }
506 break;
507 case (is_string($val) || $type == 'string'):
508 $this->debug("serialize_val: serialize string");
509 $val = $this->expandEntities($val);
510 if ($use == 'literal') {
511 $xml .= "<$name$xmlns$atts>$val</$name>";
512 } else {
513 $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val</$name>";
514 }
515 break;
516 case is_object($val):
517 $this->debug("serialize_val: serialize object");
518 if (get_class($val) == 'soapval') {
519 $this->debug("serialize_val: serialize soapval object");
520 $pXml = $val->serialize($use);
521 $this->appendDebug($val->getDebug());
522 $val->clearDebug();
523 } else {
524 if (! $name) {
525 $name = get_class($val);
526 $this->debug("In serialize_val, used class name $name as element name");
527 } else {
528 $this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val));
529 }
530 foreach (get_object_vars($val) as $k => $v) {
531 $pXml = isset($pXml) ? $pXml . $this->serialize_val($v, $k, false, false, false, false, $use) : $this->serialize_val($v, $k, false, false, false, false, $use);
532 }
533 }
534 if (isset($type) && isset($type_prefix)) {
535 $type_str = " xsi:type=\"$type_prefix:$type\"";
536 } else {
537 $type_str = '';
538 }
539 if ($use == 'literal') {
540 $xml .= "<$name$xmlns$atts>$pXml</$name>";
541 } else {
542 $xml .= "<$name$xmlns$type_str$atts>$pXml</$name>";
543 }
544 break;
545 break;
546 case (is_array($val) || $type):
547 // detect if struct or array
548 $valueType = $this->isArraySimpleOrStruct($val);
549 if ($valueType == 'arraySimple' || preg_match('/^ArrayOf/', $type)) {
550 $this->debug("serialize_val: serialize array");
551 $i = 0;
552 if (is_array($val) && count($val) > 0) {
553 foreach ($val as $v) {
554 if (is_object($v) && get_class($v) == 'soapval') {
555 $tt_ns = $v->type_ns;
556 $tt = $v->type;
557 } elseif (is_array($v)) {
558 $tt = $this->isArraySimpleOrStruct($v);
559 } else {
560 $tt = gettype($v);
561 }
562 $array_types[$tt] = 1;
563 // TODO: for literal, the name should be $name
564 $xml .= $this->serialize_val($v, 'item', false, false, false, false, $use);
565 ++$i;
566 }
567 if (count($array_types) > 1) {
568 $array_typename = 'xsd:anyType';
569 } elseif (isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
570 if ($tt == 'integer') {
571 $tt = 'int';
572 }
573 $array_typename = 'xsd:' . $tt;
574 } elseif (isset($tt) && $tt == 'arraySimple') {
575 $array_typename = 'SOAP-ENC:Array';
576 } elseif (isset($tt) && $tt == 'arrayStruct') {
577 $array_typename = 'unnamed_struct_use_soapval';
578 } else {
579 // if type is prefixed, create type prefix
580 if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']) {
581 $array_typename = 'xsd:' . $tt;
582 } elseif ($tt_ns) {
583 $tt_prefix = 'ns' . rand(1000, 9999);
584 $array_typename = "$tt_prefix:$tt";
585 $xmlns .= " xmlns:$tt_prefix=\"$tt_ns\"";
586 } else {
587 $array_typename = $tt;
588 }
589 }
590 $array_type = $i;
591 if ($use == 'literal') {
592 $type_str = '';
593 } elseif (isset($type) && isset($type_prefix)) {
594 $type_str = " xsi:type=\"$type_prefix:$type\"";
595 } else {
596 $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"" . $array_typename . "[$array_type]\"";
597 }
598 // empty array
599 } else {
600 if ($use == 'literal') {
601 $type_str = '';
602 } elseif (isset($type) && isset($type_prefix)) {
603 $type_str = " xsi:type=\"$type_prefix:$type\"";
604 } else {
605 $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\"";
606 }
607 }
608 // TODO: for array in literal, there is no wrapper here
609 $xml = "<$name$xmlns$type_str$atts>" . $xml . "</$name>";
610 } else {
611 // got a struct
612 $this->debug("serialize_val: serialize struct");
613 if (isset($type) && isset($type_prefix)) {
614 $type_str = " xsi:type=\"$type_prefix:$type\"";
615 } else {
616 $type_str = '';
617 }
618 if ($use == 'literal') {
619 $xml .= "<$name$xmlns$atts>";
620 } else {
621 $xml .= "<$name$xmlns$type_str$atts>";
622 }
623 foreach ($val as $k => $v) {
624 // Apache Map
625 if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
626 $xml .= '<item>';
627 $xml .= $this->serialize_val($k, 'key', false, false, false, false, $use);
628 $xml .= $this->serialize_val($v, 'value', false, false, false, false, $use);
629 $xml .= '</item>';
630 } else {
631 $xml .= $this->serialize_val($v, $k, false, false, false, false, $use);
632 }
633 }
634 $xml .= "</$name>";
635 }
636 break;
637 default:
638 $this->debug("serialize_val: serialize unknown");
639 $xml .= 'not detected, got ' . gettype($val) . ' for ' . $val;
640 break;
641 }
642 $this->debug("serialize_val returning $xml");
643 return $xml;
644 }
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:250
serialize_val($val, $name=false, $type=false, $name_ns=false, $type_ns=false, $attributes=false, $use='encoded', $soapval=false)
serializes PHP values in accordance w/ section 5.
Definition: nusoap.php:391
expandEntities($val)
expands entities, e.g.
Definition: nusoap.php:321
isArraySimpleOrStruct($val)
detect if array is a simple array or a struct (associative array)
Definition: nusoap.php:365

References appendDebug(), debug(), expandEntities(), isArraySimpleOrStruct(), serialize_val(), and varDump().

Referenced by nusoap_client\call(), soapval\serialize(), nusoap_fault\serialize(), nusoap_server\serialize_return(), serialize_val(), wsdl\serializeComplexTypeElements(), serializeEnvelope(), and wsdl\serializeType().

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

◆ serializeEnvelope()

nusoap_base::serializeEnvelope (   $body,
  $headers = false,
  $namespaces = array(),
  $style = 'rpc',
  $use = 'encoded',
  $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/' 
)

serializes a message

Parameters
string$bodythe XML of the SOAP body
mixed$headersoptional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array
array$namespacesoptional the namespaces used in generating the body and headers
string$styleoptional (rpc|document)
string$useoptional (encoded|literal)
string$encodingStyleoptional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
Returns
string the message @access public

Definition at line 658 of file nusoap.php.

658 ://schemas.xmlsoap.org/soap/encoding/')
659 {
660 // TODO: add an option to automatically run utf8_encode on $body and $headers
661 // if $this->soap_defencoding is UTF-8. Not doing this automatically allows
662 // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1
663
664 $this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle");
665 $this->debug("headers:");
666 $this->appendDebug($this->varDump($headers));
667 $this->debug("namespaces:");
668 $this->appendDebug($this->varDump($namespaces));
669
670 // serialize namespaces
671 $ns_string = '';
672 foreach (array_merge($this->namespaces, $namespaces) as $k => $v) {
673 $ns_string .= " xmlns:$k=\"$v\"";
674 }
675 if ($encodingStyle) {
676 $ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
677 }
678
679 // serialize headers
680 if ($headers) {
681 if (is_array($headers)) {
682 $xml = '';
683 foreach ($headers as $k => $v) {
684 if (is_object($v) && get_class($v) == 'soapval') {
685 $xml .= $this->serialize_val($v, false, false, false, false, false, $use);
686 } else {
687 $xml .= $this->serialize_val($v, $k, false, false, false, false, $use);
688 }
689 }
690 $headers = $xml;
691 $this->debug("In serializeEnvelope, serialized array of headers to $headers");
692 }
693 $headers = "<SOAP-ENV:Header>" . $headers . "</SOAP-ENV:Header>";
694 }
695 // serialize envelope
696 return
697 '<?xml version="1.0" encoding="' . $this->soap_defencoding . '"?' . ">" .
698 '<SOAP-ENV:Envelope' . $ns_string . ">" .
699 $headers .
700 "<SOAP-ENV:Body>" .
701 $body .
702 "</SOAP-ENV:Body>" .
703 "</SOAP-ENV:Envelope>";
704 }

References $namespaces, appendDebug(), debug(), serialize_val(), and varDump().

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

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

◆ setDebugLevel()

nusoap_base::setDebugLevel (   $level)

sets the debug level for this instance

Parameters
int$levelDebug level 0-9, where 0 turns off @access public

Definition at line 239 of file nusoap.php.

240 {
241 $this->debugLevel = $level;
242 }

◆ setError()

◆ setGlobalDebugLevel()

nusoap_base::setGlobalDebugLevel (   $level)

sets the global debug level, which applies to future instances

Parameters
int$levelDebug level 0-9, where 0 turns off @access public

Definition at line 217 of file nusoap.php.

218 {
219 $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = $level;
220 }

References $GLOBALS.

◆ varDump()

Field Documentation

◆ $charencoding

nusoap_base::$charencoding = true

Definition at line 98 of file nusoap.php.

◆ $debug_str

nusoap_base::$debug_str = ''

Definition at line 90 of file nusoap.php.

Referenced by getDebug().

◆ $debugLevel

nusoap_base::$debugLevel

Definition at line 105 of file nusoap.php.

Referenced by getDebugLevel().

◆ $error_str

nusoap_base::$error_str = ''

Definition at line 83 of file nusoap.php.

Referenced by soap_transport_http\connect(), and getError().

◆ $namespaces

nusoap_base::$namespaces
Initial value:
= array(
'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
'xsd' => 'http://www.w3.org/2001/XMLSchema',
'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/'
)

Definition at line 132 of file nusoap.php.

Referenced by nusoap_xmlschema\__construct(), and serializeEnvelope().

◆ $revision

nusoap_base::$revision = '$Revision$'

Definition at line 76 of file nusoap.php.

◆ $soap_defencoding

nusoap_base::$soap_defencoding = 'UTF-8'

◆ $title

nusoap_base::$title = 'NuSOAP'

Definition at line 62 of file nusoap.php.

◆ $typemap

nusoap_base::$typemap
Initial value:
= array(
'http://www.w3.org/2001/XMLSchema' => array(
'string' => 'string','boolean' => 'boolean','float' => 'double','double' => 'double','decimal' => 'double',
'duration' => '','dateTime' => 'string','time' => 'string','date' => 'string','gYearMonth' => '',
'gYear' => '','gMonthDay' => '','gDay' => '','gMonth' => '','hexBinary' => 'string','base64Binary' => 'string',
'anyType' => 'string','anySimpleType' => 'string',
'normalizedString' => 'string','token' => 'string','language' => '','NMTOKEN' => '','NMTOKENS' => '','Name' => '','NCName' => '','ID' => '',
'IDREF' => '','IDREFS' => '','ENTITY' => '','ENTITIES' => '','integer' => 'integer','nonPositiveInteger' => 'integer',
'negativeInteger' => 'integer','long' => 'integer','int' => 'integer','short' => 'integer','byte' => 'integer','nonNegativeInteger' => 'integer',
'unsignedLong' => '','unsignedInt' => '','unsignedShort' => '','unsignedByte' => '','positiveInteger' => ''),
'http://www.w3.org/2000/10/XMLSchema' => array(
'i4' => '','int' => 'integer','boolean' => 'boolean','string' => 'string','double' => 'double',
'float' => 'double','dateTime' => 'string',
'timeInstant' => 'string','base64Binary' => 'string','base64' => 'string','ur-type' => 'array'),
'http://www.w3.org/1999/XMLSchema' => array(
'i4' => '','int' => 'integer','boolean' => 'boolean','string' => 'string','double' => 'double',
'float' => 'double','dateTime' => 'string',
'timeInstant' => 'string','base64Binary' => 'string','base64' => 'string','ur-type' => 'array'),
'http://soapinterop.org/xsd' => array('SOAPStruct' => 'struct'),
'http://schemas.xmlsoap.org/soap/encoding/' => array('base64' => 'string','array' => 'array','Array' => 'array'),
'http://xml.apache.org/xml-soap' => array('Map')
)

Definition at line 154 of file nusoap.php.

◆ $usedNamespaces

nusoap_base::$usedNamespaces = array()

Definition at line 145 of file nusoap.php.

Referenced by nusoap_client\call().

◆ $version

nusoap_base::$version = '0.7.3'

Definition at line 69 of file nusoap.php.

◆ $xmlEntities

nusoap_base::$xmlEntities
Initial value:
= array('quot' => '"','amp' => '&',
'lt' => '<','gt' => '>','apos' => "'")

Definition at line 187 of file nusoap.php.

◆ $XMLSchemaVersion

nusoap_base::$XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'

Definition at line 113 of file nusoap.php.

Referenced by nusoap_parser\start_element().


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