ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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

public

Definition at line 235 of file nusoap.php.

References $GLOBALS.

236  {
237  $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
238  }
$GLOBALS["DIC"]
Definition: wac.php:30

Member Function Documentation

◆ __toString()

nusoap_base::__toString ( )

represents the object as a string

Returns
string public

Definition at line 922 of file nusoap.php.

References varDump().

923  {
924  return $this->varDump($this);
925  }
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:907
+ Here is the call graph for this function:

◆ appendDebug()

◆ clearDebug()

nusoap_base::clearDebug ( )

clears the current debug data for this instance

public

Definition at line 317 of file nusoap.php.

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

318  {
319  // it would be nice to use a memory stream here to use
320  // memory more efficiently
321  $this->debug_str = '';
322  }
+ 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 private

Definition at line 767 of file nusoap.php.

References getPrefixFromNamespace().

768  {
769  // get element namespace
770  //$this->xdebug("Contract $qname");
771  if (strrpos($qname, ':')) {
772  // get unqualified name
773  $name = substr($qname, strrpos($qname, ':') + 1);
774  // get ns
775  $ns = substr($qname, 0, strrpos($qname, ':'));
776  $p = $this->getPrefixFromNamespace($ns);
777  if ($p) {
778  return $p . ':' . $name;
779  }
780  return $qname;
781  } else {
782  return $qname;
783  }
784  }
getPrefixFromNamespace($ns)
returns the prefix for a given namespace (or prefix) or false if no prefixes registered for the given...
Definition: nusoap.php:870
+ 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 private

Definition at line 290 of file nusoap.php.

References appendDebug(), and getmicrotime().

Referenced by nusoap_xmlschema\__construct(), soap_transport_http\__construct(), nusoap_server\__construct(), wsdl\__construct(), nusoap_parser\__construct(), nusoap_client\__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(), soap_transport_http\setCredentials(), wsdl\setCredentials(), nusoap_client\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().

291  {
292  if ($this->debugLevel > 0) {
293  $this->appendDebug($this->getmicrotime() . ' ' . get_class($this) . ": $string\n");
294  }
295  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:303
getmicrotime()
returns the time in ODBC canonical form with microseconds
Definition: nusoap.php:887
+ 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. private

Definition at line 361 of file nusoap.php.

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

362  {
363  if ($this->charencoding) {
364  $val = str_replace('&', '&amp;', $val);
365  $val = str_replace("'", '&apos;', $val);
366  $val = str_replace('"', '&quot;', $val);
367  $val = str_replace('<', '&lt;', $val);
368  $val = str_replace('>', '&gt;', $val);
369  }
370  return $val;
371  }
+ 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 private

Definition at line 793 of file nusoap.php.

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

794  {
795  // get element prefix
796  if (strpos($qname, ':') && !preg_match('/^http:\/\//', $qname)) {
797  // get unqualified name
798  $name = substr(strstr($qname, ':'), 1);
799  // get ns prefix
800  $prefix = substr($qname, 0, strpos($qname, ':'));
801  if (isset($this->namespaces[$prefix])) {
802  return $this->namespaces[$prefix] . ':' . $name;
803  } else {
804  return $qname;
805  }
806  } else {
807  return $qname;
808  }
809  }
+ 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 public
Deprecated:

Definition at line 754 of file nusoap.php.

755  {
756  $str = htmlspecialchars($str);
757  return nl2br($str);
758  }

◆ getDebug()

& nusoap_base::getDebug ( )

gets the current debug data for this instance

Returns
debug data public

Definition at line 330 of file nusoap.php.

References $debug_str.

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

331  {
332  // it would be nice to use a memory stream here to use
333  // memory more efficiently
334  return $this->debug_str;
335  }
+ 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 public

Definition at line 344 of file nusoap.php.

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

345  {
346  // it would be nice to use a memory stream here to use
347  // memory more efficiently
348  while (strpos($this->debug_str, '--')) {
349  $this->debug_str = str_replace('--', '- -', $this->debug_str);
350  }
351  $ret = "<!--\n" . $this->debug_str . "\n-->";
352  return $ret;
353  }
+ 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 public

Definition at line 268 of file nusoap.php.

References $debugLevel.

269  {
270  return $this->debugLevel;
271  }

◆ getError()

nusoap_base::getError ( )

returns error string if present

Returns
mixed error string or false public

Definition at line 379 of file nusoap.php.

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(), nusoap_server\serialize_return(), and showResult().

380  {
381  if ($this->error_str != '') {
382  return $this->error_str;
383  }
384  return false;
385  }
+ 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 public

Definition at line 246 of file nusoap.php.

References $GLOBALS.

247  {
248  return $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
249  }
$GLOBALS["DIC"]
Definition: wac.php:30

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

Definition at line 819 of file nusoap.php.

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().

820  {
821  if ($sstr = strrchr($str, ':')) {
822  // get unqualified name
823  return substr($sstr, 1);
824  } else {
825  return $str;
826  }
827  }
+ 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 public

Definition at line 887 of file nusoap.php.

Referenced by debug().

888  {
889  if (function_exists('gettimeofday')) {
890  $tod = gettimeofday();
891  $sec = $tod['sec'];
892  $usec = $tod['usec'];
893  } else {
894  $sec = time();
895  $usec = 0;
896  }
897  return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec);
898  }
+ 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 public

Definition at line 853 of file nusoap.php.

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

854  {
855  if (isset($this->namespaces[$prefix])) {
856  return $this->namespaces[$prefix];
857  }
858  //$this->setError("No namespace registered for prefix '$prefix'");
859  return false;
860  }
+ 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 public

Definition at line 837 of file nusoap.php.

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().

838  {
839  if ($pos = strrpos($str, ':')) {
840  // get prefix
841  return substr($str, 0, $pos);
842  }
843  return false;
844  }
+ 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 public

Definition at line 870 of file nusoap.php.

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

871  {
872  foreach ($this->namespaces as $p => $n) {
873  if ($ns == $n || $ns == $p) {
874  $this->usedNamespaces[$p] = $n;
875  return $p;
876  }
877  }
878  return false;
879  }
+ 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) private

Definition at line 405 of file nusoap.php.

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

406  {
407  $keyList = array_keys($val);
408  foreach ($keyList as $keyListValue) {
409  if (!is_int($keyListValue)) {
410  return 'arrayStruct';
411  }
412  }
413  return 'arraySimple';
414  }
+ 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 public

Definition at line 431 of file nusoap.php.

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

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

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

Definition at line 698 of file nusoap.php.

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

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

698  ://schemas.xmlsoap.org/soap/encoding/')
699  {
700  // TODO: add an option to automatically run utf8_encode on $body and $headers
701  // if $this->soap_defencoding is UTF-8. Not doing this automatically allows
702  // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1
703 
704  $this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle");
705  $this->debug("headers:");
706  $this->appendDebug($this->varDump($headers));
707  $this->debug("namespaces:");
708  $this->appendDebug($this->varDump($namespaces));
709 
710  // serialize namespaces
711  $ns_string = '';
712  foreach (array_merge($this->namespaces, $namespaces) as $k => $v) {
713  $ns_string .= " xmlns:$k=\"$v\"";
714  }
715  if ($encodingStyle) {
716  $ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
717  }
718 
719  // serialize headers
720  if ($headers) {
721  if (is_array($headers)) {
722  $xml = '';
723  foreach ($headers as $k => $v) {
724  if (is_object($v) && get_class($v) == 'soapval') {
725  $xml .= $this->serialize_val($v, false, false, false, false, false, $use);
726  } else {
727  $xml .= $this->serialize_val($v, $k, false, false, false, false, $use);
728  }
729  }
730  $headers = $xml;
731  $this->debug("In serializeEnvelope, serialized array of headers to $headers");
732  }
733  $headers = "<SOAP-ENV:Header>" . $headers . "</SOAP-ENV:Header>";
734  }
735  // serialize envelope
736  return
737  '<?xml version="1.0" encoding="' . $this->soap_defencoding . '"?' . ">" .
738  '<SOAP-ENV:Envelope' . $ns_string . ">" .
739  $headers .
740  "<SOAP-ENV:Body>" .
741  $body .
742  "</SOAP-ENV:Body>" .
743  "</SOAP-ENV:Envelope>";
744  }
appendDebug($string)
adds debug data to the instance debug string without formatting
Definition: nusoap.php:303
debug($string)
adds debug data to the instance debug string with formatting
Definition: nusoap.php:290
varDump($data)
Returns a string with the output of var_dump.
Definition: nusoap.php:907
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:431
+ 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 public

Definition at line 279 of file nusoap.php.

280  {
281  $this->debugLevel = $level;
282  }

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

Definition at line 257 of file nusoap.php.

References $GLOBALS.

258  {
259  $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = $level;
260  }
$GLOBALS["DIC"]
Definition: wac.php:30

◆ varDump()

Field Documentation

◆ $charencoding

nusoap_base::$charencoding = true

Definition at line 138 of file nusoap.php.

◆ $debug_str

nusoap_base::$debug_str = ''

Definition at line 130 of file nusoap.php.

Referenced by getDebug().

◆ $debugLevel

nusoap_base::$debugLevel

Definition at line 145 of file nusoap.php.

Referenced by getDebugLevel().

◆ $error_str

nusoap_base::$error_str = ''

Definition at line 123 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 172 of file nusoap.php.

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

◆ $revision

nusoap_base::$revision = '$Revision$'

Definition at line 116 of file nusoap.php.

◆ $soap_defencoding

nusoap_base::$soap_defencoding = 'UTF-8'

◆ $title

nusoap_base::$title = 'NuSOAP'

Definition at line 102 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 194 of file nusoap.php.

◆ $usedNamespaces

nusoap_base::$usedNamespaces = array()

Definition at line 185 of file nusoap.php.

Referenced by nusoap_client\call().

◆ $version

nusoap_base::$version = '0.7.3'

Definition at line 109 of file nusoap.php.

◆ $xmlEntities

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

Definition at line 227 of file nusoap.php.

◆ $XMLSchemaVersion

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

Definition at line 153 of file nusoap.php.

Referenced by nusoap_parser\start_element().


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