Public Member Functions | Data Fields

nusoap_base Class Reference

nusoap_base More...

Inheritance diagram for nusoap_base:

Public Member Functions

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

Data Fields

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

Detailed Description

nusoap_base

Author:
Dietrich Ayala <dietrich@ganx4.com>
Version:
Id:
nusoap.php 11808 2006-08-08 09:57:04Z akill

public

Author:
Dietrich Ayala <dietrich@ganx4.com>
Version:
Id:
class.nusoap_base.php 14918 2007-10-07 17:02:40Z rkuester

public

Author:
Dietrich Ayala <dietrich@ganx4.com>
Version:
Id:
nusoap.php 16602 2008-05-08 14:27:44Z rkuester

public

Definition at line 61 of file nusoap.php.


Member Function Documentation

nusoap_base::appendDebug ( string  ) 

adds debug data to the instance debug string without formatting

Parameters:
string $string debug data public

Definition at line 267 of file class.nusoap_base.php.

Referenced by XMLSchema::addComplexType(), XMLSchema::addElement(), XMLSchema::addSimpleType(), soap_client::call(), debug(), wsdl::end_element(), wsdl::getTypeDef(), soap_server::invoke_method(), soap_client::parseResponse(), wsdl::parseWSDL(), XMLSchema::schemaStartElement(), soap_client::send(), soap_server::serialize_return(), serialize_val(), serializeEnvelope(), wsdl::serializeParameters(), wsdl::serializeRPCParameters(), wsdl::serializeType(), soap_server::service(), soap_client::soap_client(), soap_server::soap_server(), and wsdl::start_element().

                                     {
                if ($this->debugLevel > 0) {
                        // it would be nice to use a memory stream here to use
                        // memory more efficiently
                        $this->debug_str .= $string;
                }
        }

Here is the caller graph for this function:

nusoap_base::appendDebug ( string  ) 

adds debug data to the instance debug string without formatting

Parameters:
string $string debug data public

Definition at line 267 of file nusoap.php.

                                     {
                if ($this->debugLevel > 0) {
                        // it would be nice to use a memory stream here to use
                        // memory more efficiently
                        $this->debug_str .= $string;
                }
        }

nusoap_base::clearDebug (  ) 

clears the current debug data for this instance

public

Definition at line 280 of file class.nusoap_base.php.

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

nusoap_base::clearDebug (  ) 

clears the current debug data for this instance

public

Definition at line 280 of file nusoap.php.

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

nusoap_base::contractQname ( qname  ) 

contracts (changes namespace to prefix) a qualified name

Parameters:
string $qname qname
Returns:
string contracted qname private

Definition at line 674 of file class.nusoap_base.php.

References getPrefixFromNamespace().

                                      {
                // get element namespace
                //$this->xdebug("Contract $qname");
                if (strrpos($qname, ':')) {
                        // get unqualified name
                        $name = substr($qname, strrpos($qname, ':') + 1);
                        // get ns
                        $ns = substr($qname, 0, strrpos($qname, ':'));
                        $p = $this->getPrefixFromNamespace($ns);
                        if ($p) {
                                return $p . ':' . $name;
                        }
                        return $qname;
                } else {
                        return $qname;
                }
        }

Here is the call graph for this function:

nusoap_base::contractQname ( qname  ) 

contracts a qualified name

Parameters:
string $string qname
Returns:
string contracted qname private

Definition at line 458 of file nusoap.php.

References getPrefixFromNamespace().

                                      {
                // get element namespace
                //$this->xdebug("Contract $qname");
                if (strrpos($qname, ':')) {
                        // get unqualified name
                        $name = substr($qname, strrpos($qname, ':') + 1);
                        // get ns
                        $ns = substr($qname, 0, strrpos($qname, ':'));
                        $p = $this->getPrefixFromNamespace($ns);
                        if ($p) {
                                return $p . ':' . $name;
                        }
                        return $qname;
                } else {
                        return $qname;
                }
        }

Here is the call graph for this function:

nusoap_base::contractQname ( qname  ) 

contracts (changes namespace to prefix) a qualified name

Parameters:
string $qname qname
Returns:
string contracted qname private

Definition at line 674 of file nusoap.php.

References getPrefixFromNamespace().

                                      {
                // get element namespace
                //$this->xdebug("Contract $qname");
                if (strrpos($qname, ':')) {
                        // get unqualified name
                        $name = substr($qname, strrpos($qname, ':') + 1);
                        // get ns
                        $ns = substr($qname, 0, strrpos($qname, ':'));
                        $p = $this->getPrefixFromNamespace($ns);
                        if ($p) {
                                return $p . ':' . $name;
                        }
                        return $qname;
                } else {
                        return $qname;
                }
        }

Here is the call graph for this function:

nusoap_base::debug ( string  ) 

adds debug data to the class level debug string

Parameters:
string $string debug data private

Definition at line 144 of file nusoap.php.

Referenced by soap_transport_http::buildPayload(), soap_parser::buildVal(), soap_client::call(), soap_client::checkCookies(), soap_transport_http::connect(), soap_transport_http::decodeChunked(), soap_parser::decodeSimple(), wsdl::end_element(), soap_transport_http::getCookiesForRequest(), nusoapservermime::getHTTPBody(), soap_clientmime::getHTTPBody(), soap_client::getOperationData(), soap_transport_http::getResponse(), wsdl::getTypeDef(), soap_server::invoke_method(), soap_server::parse_http_headers(), soap_server::parse_request(), XMLSchema::parseFile(), nusoapservermime::parseRequest(), soap_server::parseRequest(), soap_clientmime::parseResponse(), soap_client::parseResponse(), XMLSchema::parseString(), wsdl::parseWSDL(), soap_client::send(), soap_transport_http::send(), soap_server::send_response(), soap_transport_http::sendRequest(), soap_server::serialize_return(), serialize_val(), wsdl::serializeComplexTypeAttributes(), wsdl::serializeComplexTypeElements(), serializeEnvelope(), wsdl::serializeParameters(), wsdl::serializeRPCParameters(), wsdl::serializeType(), soap_server::service(), soap_transport_http::setContentType(), soap_transport_http::setCredentials(), soap_transport_http::setEncoding(), soap_transport_http::setProxy(), soap_transport_http::setSOAPAction(), soap_transport_http::setURL(), soap_client::soap_client(), soap_parser::soap_parser(), soap_server::soap_server(), soap_transport_http::soap_transport_http(), soap_parser::start_element(), wsdl::start_element(), soap_client::UpdateCookies(), soap_transport_http::usePersistentConnection(), wsdl::wsdl(), XMLSchema::xdebug(), and XMLSchema::XMLSchema().

                               {
                $this->debug_str .= get_class($this).": $string\n";
        }

Here is the caller graph for this function:

nusoap_base::debug ( string  ) 

adds debug data to the instance debug string with formatting

Parameters:
string $string debug data private

Definition at line 255 of file nusoap.php.

References appendDebug(), and getmicrotime().

                               {
                if ($this->debugLevel > 0) {
                        $this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n");
                }
        }

Here is the call graph for this function:

nusoap_base::debug ( string  ) 

adds debug data to the instance debug string with formatting

Parameters:
string $string debug data private

Definition at line 255 of file class.nusoap_base.php.

References appendDebug(), and getmicrotime().

                               {
                if ($this->debugLevel > 0) {
                        $this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n");
                }
        }

Here is the call graph for this function:

nusoap_base::expandEntities ( val  ) 

expands entities, e.g.

changes '<' to '<'.

Parameters:
string $val The string in which to expand entities. private

Definition at line 154 of file nusoap.php.

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

                                      {
                if ($this->charencoding) {
                $val = str_replace('&', '&amp;', $val);
                $val = str_replace("'", '&apos;', $val);
                $val = str_replace('"', '&quot;', $val);
                $val = str_replace('<', '&lt;', $val);
                $val = str_replace('>', '&gt;', $val);
            }
            return $val;
        }

Here is the caller graph for this function:

nusoap_base::expandEntities ( val  ) 

expands entities, e.g.

changes '<' to '<'.

Parameters:
string $val The string in which to expand entities. private

Definition at line 320 of file class.nusoap_base.php.

                                      {
                if ($this->charencoding) {
                $val = str_replace('&', '&amp;', $val);
                $val = str_replace("'", '&apos;', $val);
                $val = str_replace('"', '&quot;', $val);
                $val = str_replace('<', '&lt;', $val);
                $val = str_replace('>', '&gt;', $val);
            }
            return $val;
        }

nusoap_base::expandEntities ( val  ) 

expands entities, e.g.

changes '<' to '<'.

Parameters:
string $val The string in which to expand entities. private

Definition at line 320 of file nusoap.php.

                                      {
                if ($this->charencoding) {
                $val = str_replace('&', '&amp;', $val);
                $val = str_replace("'", '&apos;', $val);
                $val = str_replace('"', '&quot;', $val);
                $val = str_replace('<', '&lt;', $val);
                $val = str_replace('>', '&gt;', $val);
            }
            return $val;
        }

nusoap_base::expandQname ( qname  ) 

expands (changes prefix to namespace) a qualified name

Parameters:
string $string qname
Returns:
string expanded qname private

Definition at line 699 of file class.nusoap_base.php.

                                    {
                // get element prefix
                if(strpos($qname,':') && !ereg('^http://',$qname)){
                        // get unqualified name
                        $name = substr(strstr($qname,':'),1);
                        // get ns prefix
                        $prefix = substr($qname,0,strpos($qname,':'));
                        if(isset($this->namespaces[$prefix])){
                                return $this->namespaces[$prefix].':'.$name;
                        } else {
                                return $qname;
                        }
                } else {
                        return $qname;
                }
        }

nusoap_base::expandQname ( qname  ) 

expands a qualified name

Parameters:
string $string qname
Returns:
string expanded qname private

Definition at line 483 of file nusoap.php.

Referenced by wsdl::addComplexType(), wsdl::addSimpleType(), XMLSchema::schemaStartElement(), and wsdl::start_element().

                                    {
                // get element prefix
                if(strpos($qname,':') && !ereg('^http://',$qname)){
                        // get unqualified name
                        $name = substr(strstr($qname,':'),1);
                        // get ns prefix
                        $prefix = substr($qname,0,strpos($qname,':'));
                        if(isset($this->namespaces[$prefix])){
                                return $this->namespaces[$prefix].':'.$name;
                        } else {
                                return $qname;
                        }
                } else {
                        return $qname;
                }
        }

Here is the caller graph for this function:

nusoap_base::expandQname ( qname  ) 

expands (changes prefix to namespace) a qualified name

Parameters:
string $string qname
Returns:
string expanded qname private

Definition at line 699 of file nusoap.php.

                                    {
                // get element prefix
                if(strpos($qname,':') && !ereg('^http://',$qname)){
                        // get unqualified name
                        $name = substr(strstr($qname,':'),1);
                        // get ns prefix
                        $prefix = substr($qname,0,strpos($qname,':'));
                        if(isset($this->namespaces[$prefix])){
                                return $this->namespaces[$prefix].':'.$name;
                        } else {
                                return $qname;
                        }
                } else {
                        return $qname;
                }
        }

nusoap_base::formatDump ( str  ) 

formats a string to be inserted into an HTML stream

Parameters:
string $str The string to format
Returns:
string The formatted string public
Deprecated:

Definition at line 662 of file class.nusoap_base.php.

                             {
                $str = htmlspecialchars($str);
                return nl2br($str);
    }

nusoap_base::formatDump ( str  ) 

Definition at line 446 of file nusoap.php.

                             {
                $str = htmlspecialchars($str);
                return nl2br($str);
    }

nusoap_base::formatDump ( str  ) 

formats a string to be inserted into an HTML stream

Parameters:
string $str The string to format
Returns:
string The formatted string public
Deprecated:

Definition at line 662 of file nusoap.php.

                             {
                $str = htmlspecialchars($str);
                return nl2br($str);
    }

& nusoap_base::getDebug (  ) 

gets the current debug data for this instance

Returns:
debug data public

Definition at line 292 of file nusoap.php.

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

& nusoap_base::getDebug (  ) 

gets the current debug data for this instance

Returns:
debug data public

Definition at line 292 of file class.nusoap_base.php.

Referenced by soap_server::fault().

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

Here is the caller graph for this function:

& 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 305 of file nusoap.php.

                                         {
                // it would be nice to use a memory stream here to use
                // memory more efficiently
                while (strpos($this->debug_str, '--')) {
                        $this->debug_str = str_replace('--', '- -', $this->debug_str);
                }
        return "<!--\n" . $this->debug_str . "\n-->";
        }

& 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 305 of file class.nusoap_base.php.

Referenced by soap_server::send_response(), and soap_server::service().

                                         {
                // it would be nice to use a memory stream here to use
                // memory more efficiently
                while (strpos($this->debug_str, '--')) {
                        $this->debug_str = str_replace('--', '- -', $this->debug_str);
                }
        return "<!--\n" . $this->debug_str . "\n-->";
        }

Here is the caller graph for this function:

nusoap_base::getDebugLevel (  ) 

gets the debug level for this instance

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

Definition at line 235 of file class.nusoap_base.php.

                                 {
                return $this->debugLevel;
        }

nusoap_base::getDebugLevel (  ) 

gets the debug level for this instance

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

Definition at line 235 of file nusoap.php.

                                 {
                return $this->debugLevel;
        }

nusoap_base::getError (  ) 

returns error string if present

Returns:
boolean $string error string public

Definition at line 171 of file nusoap.php.

Referenced by soap_client::call(), wsdl::parseWSDL(), and soap_client::send().

                           {
                if($this->error_str != ''){
                        return $this->error_str;
                }
                return false;
        }

Here is the caller graph for this function:

nusoap_base::getError (  ) 

returns error string if present

Returns:
mixed error string or false public

Definition at line 337 of file nusoap.php.

                           {
                if($this->error_str != ''){
                        return $this->error_str;
                }
                return false;
        }

nusoap_base::getError (  ) 

returns error string if present

Returns:
mixed error string or false public

Definition at line 337 of file class.nusoap_base.php.

                           {
                if($this->error_str != ''){
                        return $this->error_str;
                }
                return false;
        }

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 215 of file class.nusoap_base.php.

References $GLOBALS.

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

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

References $GLOBALS.

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

nusoap_base::getLocalPart ( str  ) 

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

Parameters:
string $str The prefixed string
Returns:
string The local part public

Definition at line 724 of file class.nusoap_base.php.

                                   {
                if($sstr = strrchr($str,':')){
                        // get unqualified name
                        return substr( $sstr, 1 );
                } else {
                        return $str;
                }
        }

nusoap_base::getLocalPart ( str  ) 

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

Parameters:
string 
Returns:
string public

Definition at line 508 of file nusoap.php.

Referenced by wsdl::addOperation(), XMLSchema::schemaEndElement(), XMLSchema::schemaStartElement(), wsdl::serialize(), wsdl::serializeComplexTypeAttributes(), wsdl::serializeComplexTypeElements(), wsdl::serializeType(), soap_parser::start_element(), and wsdl::start_element().

                                   {
                if($sstr = strrchr($str,':')){
                        // get unqualified name
                        return substr( $sstr, 1 );
                } else {
                        return $str;
                }
        }

Here is the caller graph for this function:

nusoap_base::getLocalPart ( str  ) 

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

Parameters:
string $str The prefixed string
Returns:
string The local part public

Definition at line 724 of file nusoap.php.

                                   {
                if($sstr = strrchr($str,':')){
                        // get unqualified name
                        return substr( $sstr, 1 );
                } else {
                        return $str;
                }
        }

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

                                {
                if (function_exists('gettimeofday')) {
                        $tod = gettimeofday();
                        $sec = $tod['sec'];
                        $usec = $tod['usec'];
                } else {
                        $sec = time();
                        $usec = 0;
                }
                return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec);
        }

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 788 of file class.nusoap_base.php.

Referenced by debug().

                                {
                if (function_exists('gettimeofday')) {
                        $tod = gettimeofday();
                        $sec = $tod['sec'];
                        $usec = $tod['usec'];
                } else {
                        $sec = time();
                        $usec = 0;
                }
                return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec);
        }

Here is the caller graph for this function:

nusoap_base::getNamespaceFromPrefix ( prefix  ) 

pass it a prefix, it returns a namespace

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

Definition at line 756 of file class.nusoap_base.php.

                                                {
                if (isset($this->namespaces[$prefix])) {
                        return $this->namespaces[$prefix];
                }
                //$this->setError("No namespace registered for prefix '$prefix'");
                return false;
        }

nusoap_base::getNamespaceFromPrefix ( prefix  ) 

pass it a prefix, it returns a namespace returns false if no namespace registered with the given prefix

Parameters:
string 
Returns:
mixed public

Definition at line 541 of file nusoap.php.

Referenced by wsdl::addOperation(), XMLSchema::schemaStartElement(), wsdl::serialize(), wsdl::serializeComplexTypeAttributes(), wsdl::serializeComplexTypeElements(), and wsdl::serializeType().

                                                {
                if (isset($this->namespaces[$prefix])) {
                        return $this->namespaces[$prefix];
                }
                //$this->setError("No namespace registered for prefix '$prefix'");
                return false;
        }

Here is the caller graph for this function:

nusoap_base::getNamespaceFromPrefix ( prefix  ) 

pass it a prefix, it returns a namespace

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

Definition at line 756 of file nusoap.php.

                                                {
                if (isset($this->namespaces[$prefix])) {
                        return $this->namespaces[$prefix];
                }
                //$this->setError("No namespace registered for prefix '$prefix'");
                return false;
        }

nusoap_base::getPrefix ( str  ) 

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

Parameters:
string $str The prefixed string
Returns:
mixed The prefix or false if there is no prefix public

Definition at line 741 of file class.nusoap_base.php.

                                {
                if($pos = strrpos($str,':')){
                        // get prefix
                        return substr($str,0,$pos);
                }
                return false;
        }

nusoap_base::getPrefix ( str  ) 

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

Parameters:
string 
Returns:
mixed public

Definition at line 525 of file nusoap.php.

Referenced by XMLSchema::addElement(), wsdl::addOperation(), XMLSchema::schemaEndElement(), XMLSchema::schemaStartElement(), wsdl::serialize(), wsdl::serializeComplexTypeAttributes(), wsdl::serializeComplexTypeElements(), wsdl::serializeType(), and soap_parser::start_element().

                                {
                if($pos = strrpos($str,':')){
                        // get prefix
                        return substr($str,0,$pos);
                }
                return false;
        }

Here is the caller graph for this function:

nusoap_base::getPrefix ( str  ) 

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

Parameters:
string $str The prefixed string
Returns:
mixed The prefix or false if there is no prefix public

Definition at line 741 of file nusoap.php.

                                {
                if($pos = strrpos($str,':')){
                        // get prefix
                        return substr($str,0,$pos);
                }
                return false;
        }

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 $ns The namespace
Returns:
mixed The prefix, false if the namespace has no prefixes public

Definition at line 772 of file class.nusoap_base.php.

                                             {
                foreach ($this->namespaces as $p => $n) {
                        if ($ns == $n || $ns == $p) {
                            $this->usedNamespaces[$p] = $n;
                                return $p;
                        }
                }
                return false;
        }

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 
Returns:
mixed public

Definition at line 557 of file nusoap.php.

Referenced by contractQname(), XMLSchema::schemaStartElement(), wsdl::serialize(), XMLSchema::serializeSchema(), wsdl::serializeType(), and wsdl::start_element().

                                             {
                foreach ($this->namespaces as $p => $n) {
                        if ($ns == $n || $ns == $p) {
                            $this->usedNamespaces[$p] = $n;
                                return $p;
                        }
                }
                return false;
        }

Here is the caller graph for this function:

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 $ns The namespace
Returns:
mixed The prefix, false if the namespace has no prefixes public

Definition at line 772 of file nusoap.php.

                                             {
                foreach ($this->namespaces as $p => $n) {
                        if ($ns == $n || $ns == $p) {
                            $this->usedNamespaces[$p] = $n;
                                return $p;
                        }
                }
                return false;
        }

nusoap_base::isArraySimpleOrStruct ( val  ) 

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

Parameters:
$val The PHP array
Returns:
string (arraySimple|arrayStruct) private

Definition at line 195 of file nusoap.php.

Referenced by serialize_val(), wsdl::serializeComplexTypeElements(), wsdl::serializeParameters(), wsdl::serializeRPCParameters(), and wsdl::serializeType().

                                             {
        $keyList = array_keys($val);
                foreach ($keyList as $keyListValue) {
                        if (!is_int($keyListValue)) {
                                return 'arrayStruct';
                        }
                }
                return 'arraySimple';
        }

Here is the caller graph for this function:

nusoap_base::isArraySimpleOrStruct ( val  ) 

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

Parameters:
mixed $val The PHP array
Returns:
string (arraySimple|arrayStruct) private

Definition at line 361 of file class.nusoap_base.php.

                                             {
        $keyList = array_keys($val);
                foreach ($keyList as $keyListValue) {
                        if (!is_int($keyListValue)) {
                                return 'arrayStruct';
                        }
                }
                return 'arraySimple';
        }

nusoap_base::isArraySimpleOrStruct ( val  ) 

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

Parameters:
mixed $val The PHP array
Returns:
string (arraySimple|arrayStruct) private

Definition at line 361 of file nusoap.php.

                                             {
        $keyList = array_keys($val);
                foreach ($keyList as $keyListValue) {
                        if (!is_int($keyListValue)) {
                                return 'arrayStruct';
                        }
                }
                return 'arraySimple';
        }

nusoap_base::nusoap_base (  ) 

constructor

public

Definition at line 205 of file class.nusoap_base.php.

References $GLOBALS.

Referenced by soap_client::soap_client(), soap_fault::soap_fault(), soap_parser::soap_parser(), soap_server::soap_server(), soap_transport_http::soap_transport_http(), soapval::soapval(), wsdl::wsdl(), and XMLSchema::XMLSchema().

                               {
                $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
        }

Here is the caller graph for this function:

nusoap_base::nusoap_base (  ) 

constructor

public

Definition at line 205 of file nusoap.php.

References $GLOBALS.

                               {
                $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel;
        }

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

serializes PHP values in accordance w/ section 5.

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

Parameters:
mixed $val The value to serialize
string $name The name (local part) of the XML element
string $type The XML schema type (local part) for the element
string $name_ns The namespace for the name of the XML element
string $type_ns The namespace for the type of the element
array $attributes The attributes to serialize as name=>value pairs
string $use The WSDL "use" (encoded|literal)
Returns:
string The serialized element, possibly with child elements public

Definition at line 385 of file nusoap.php.

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

                                                                                                                           {
                $this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use");
                $this->appendDebug('value=' . $this->varDump($val));
                $this->appendDebug('attributes=' . $this->varDump($attributes));
                
        if(is_object($val) && get_class($val) == 'soapval'){
                return $val->serialize($use);
        }
                // force valid name if necessary
                if (is_numeric($name)) {
                        $name = '__numeric_' . $name;
                } elseif (! $name) {
                        $name = 'noname';
                }
                // if name has ns, add ns prefix to name
                $xmlns = '';
        if($name_ns){
                        $prefix = 'nu'.rand(1000,9999);
                        $name = $prefix.':'.$name;
                        $xmlns .= " xmlns:$prefix=\"$name_ns\"";
                }
                // if type is prefixed, create type prefix
                if($type_ns != '' && $type_ns == $this->namespaces['xsd']){
                        // need to fix this. shouldn't default to xsd if no ns specified
                    // w/o checking against typemap
                        $type_prefix = 'xsd';
                } elseif($type_ns){
                        $type_prefix = 'ns'.rand(1000,9999);
                        $xmlns .= " xmlns:$type_prefix=\"$type_ns\"";
                }
                // serialize attributes if present
                $atts = '';
                if($attributes){
                        foreach($attributes as $k => $v){
                                $atts .= " $k=\"".$this->expandEntities($v).'"';
                        }
                }
                // serialize null value
                if (is_null($val)) {
                        if ($use == 'literal') {
                                // TODO: depends on minOccurs
                        return "<$name$xmlns $atts/>";
                } else {
                                if (isset($type) && isset($type_prefix)) {
                                        $type_str = " xsi:type=\"$type_prefix:$type\"";
                                } else {
                                        $type_str = '';
                                }
                        return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
                }
                }
        // serialize if an xsd built-in primitive type
        if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
                if (is_bool($val)) {
                        if ($type == 'boolean') {
                                $val = $val ? 'true' : 'false';
                        } elseif (! $val) {
                                $val = 0;
                        }
                        } else if (is_string($val)) {
                                $val = $this->expandEntities($val);
                        }
                        if ($use == 'literal') {
                        return "<$name$xmlns $atts>$val</$name>";
                } else {
                        return "<$name$xmlns $atts xsi:type=\"xsd:$type\">$val</$name>";
                }
        }
                // detect type and serialize
                $xml = '';
                switch(true) {
                        case (is_bool($val) || $type == 'boolean'):
                        if ($type == 'boolean') {
                                $val = $val ? 'true' : 'false';
                        } elseif (! $val) {
                                $val = 0;
                        }
                                if ($use == 'literal') {
                                        $xml .= "<$name$xmlns $atts>$val</$name>";
                                } else {
                                        $xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val</$name>";
                                }
                                break;
                        case (is_int($val) || is_long($val) || $type == 'int'):
                                if ($use == 'literal') {
                                        $xml .= "<$name$xmlns $atts>$val</$name>";
                                } else {
                                        $xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
                                }
                                break;
                        case (is_float($val)|| is_double($val) || $type == 'float'):
                                if ($use == 'literal') {
                                        $xml .= "<$name$xmlns $atts>$val</$name>";
                                } else {
                                        $xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val</$name>";
                                }
                                break;
                        case (is_string($val) || $type == 'string'):
                                $val = $this->expandEntities($val);
                                if ($use == 'literal') {
                                        $xml .= "<$name$xmlns $atts>$val</$name>";
                                } else {
                                        $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val</$name>";
                                }
                                break;
                        case is_object($val):
                                if (! $name) {
                                        $name = get_class($val);
                                        $this->debug("In serialize_val, used class name $name as element name");
                                } else {
                                        $this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val));
                                }
                                foreach(get_object_vars($val) as $k => $v){
                                        $pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use);
                                }
                                $xml .= '<'.$name.'>'.$pXml.'</'.$name.'>';
                                break;
                        break;
                        case (is_array($val) || $type):
                                // detect if struct or array
                                $valueType = $this->isArraySimpleOrStruct($val);
                if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
                                        $i = 0;
                                        if(is_array($val) && count($val)> 0){
                                                foreach($val as $v){
                                if(is_object($v) && get_class($v) ==  'soapval'){
                                                                $tt_ns = $v->type_ns;
                                                                $tt = $v->type;
                                                        } elseif (is_array($v)) {
                                                                $tt = $this->isArraySimpleOrStruct($v);
                                                        } else {
                                                                $tt = gettype($v);
                                }
                                                        $array_types[$tt] = 1;
                                                        // TODO: for literal, the name should be $name
                                                        $xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
                                                        ++$i;
                                                }
                                                if(count($array_types) > 1){
                                                        $array_typename = 'xsd:anyType';
                                                } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
                                                        if ($tt == 'integer') {
                                                                $tt = 'int';
                                                        }
                                                        $array_typename = 'xsd:'.$tt;
                                                } elseif(isset($tt) && $tt == 'arraySimple'){
                                                        $array_typename = 'SOAP-ENC:Array';
                                                } elseif(isset($tt) && $tt == 'arrayStruct'){
                                                        $array_typename = 'unnamed_struct_use_soapval';
                                                } else {
                                                        // if type is prefixed, create type prefix
                                                        if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
                                                                 $array_typename = 'xsd:' . $tt;
                                                        } elseif ($tt_ns) {
                                                                $tt_prefix = 'ns' . rand(1000, 9999);
                                                                $array_typename = "$tt_prefix:$tt";
                                                                $xmlns .= " xmlns:$tt_prefix=\"$tt_ns\"";
                                                        } else {
                                                                $array_typename = $tt;
                                                        }
                                                }
                                                $array_type = $i;
                                                if ($use == 'literal') {
                                                        $type_str = '';
                                                } else if (isset($type) && isset($type_prefix)) {
                                                        $type_str = " xsi:type=\"$type_prefix:$type\"";
                                                } else {
                                                        $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\"";
                                                }
                                        // empty array
                                        } else {
                                                if ($use == 'literal') {
                                                        $type_str = '';
                                                } else if (isset($type) && isset($type_prefix)) {
                                                        $type_str = " xsi:type=\"$type_prefix:$type\"";
                                                } else {
                                                        $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\"";
                                                }
                                        }
                                        // TODO: for array in literal, there is no wrapper here
                                        $xml = "<$name$xmlns$type_str$atts>".$xml."</$name>";
                                } else {
                                        // got a struct
                                        if(isset($type) && isset($type_prefix)){
                                                $type_str = " xsi:type=\"$type_prefix:$type\"";
                                        } else {
                                                $type_str = '';
                                        }
                                        if ($use == 'literal') {
                                                $xml .= "<$name$xmlns $atts>";
                                        } else {
                                                $xml .= "<$name$xmlns$type_str$atts>";
                                        }
                                        foreach($val as $k => $v){
                                                // Apache Map
                                                if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
                                                        $xml .= '<item>';
                                                        $xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
                                                        $xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
                                                        $xml .= '</item>';
                                                } else {
                                                        $xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
                                                }
                                        }
                                        $xml .= "</$name>";
                                }
                                break;
                        default:
                                $xml .= 'not detected, got '.gettype($val).' for '.$val;
                                break;
                }
                return $xml;
        }

Here is the call graph for this function:

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

serializes PHP values in accordance w/ section 5.

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

Parameters:
mixed $val The value to serialize
string $name The name (local part) of the XML element
string $type The XML schema type (local part) for the element
string $name_ns The namespace for the name of the XML element
string $type_ns The namespace for the type of the element
array $attributes The attributes to serialize as name=>value pairs
string $use The WSDL "use" (encoded|literal)
Returns:
string The serialized element, possibly with child elements public

Definition at line 385 of file class.nusoap_base.php.

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

                                                                                                                           {
                $this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use");
                $this->appendDebug('value=' . $this->varDump($val));
                $this->appendDebug('attributes=' . $this->varDump($attributes));
                
        if(is_object($val) && get_class($val) == 'soapval'){
                return $val->serialize($use);
        }
                // force valid name if necessary
                if (is_numeric($name)) {
                        $name = '__numeric_' . $name;
                } elseif (! $name) {
                        $name = 'noname';
                }
                // if name has ns, add ns prefix to name
                $xmlns = '';
        if($name_ns){
                        $prefix = 'nu'.rand(1000,9999);
                        $name = $prefix.':'.$name;
                        $xmlns .= " xmlns:$prefix=\"$name_ns\"";
                }
                // if type is prefixed, create type prefix
                if($type_ns != '' && $type_ns == $this->namespaces['xsd']){
                        // need to fix this. shouldn't default to xsd if no ns specified
                    // w/o checking against typemap
                        $type_prefix = 'xsd';
                } elseif($type_ns){
                        $type_prefix = 'ns'.rand(1000,9999);
                        $xmlns .= " xmlns:$type_prefix=\"$type_ns\"";
                }
                // serialize attributes if present
                $atts = '';
                if($attributes){
                        foreach($attributes as $k => $v){
                                $atts .= " $k=\"".$this->expandEntities($v).'"';
                        }
                }
                // serialize null value
                if (is_null($val)) {
                        if ($use == 'literal') {
                                // TODO: depends on minOccurs
                        return "<$name$xmlns $atts/>";
                } else {
                                if (isset($type) && isset($type_prefix)) {
                                        $type_str = " xsi:type=\"$type_prefix:$type\"";
                                } else {
                                        $type_str = '';
                                }
                        return "<$name$xmlns$type_str $atts xsi:nil=\"true\"/>";
                }
                }
        // serialize if an xsd built-in primitive type
        if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
                if (is_bool($val)) {
                        if ($type == 'boolean') {
                                $val = $val ? 'true' : 'false';
                        } elseif (! $val) {
                                $val = 0;
                        }
                        } else if (is_string($val)) {
                                $val = $this->expandEntities($val);
                        }
                        if ($use == 'literal') {
                        return "<$name$xmlns $atts>$val</$name>";
                } else {
                        return "<$name$xmlns $atts xsi:type=\"xsd:$type\">$val</$name>";
                }
        }
                // detect type and serialize
                $xml = '';
                switch(true) {
                        case (is_bool($val) || $type == 'boolean'):
                        if ($type == 'boolean') {
                                $val = $val ? 'true' : 'false';
                        } elseif (! $val) {
                                $val = 0;
                        }
                                if ($use == 'literal') {
                                        $xml .= "<$name$xmlns $atts>$val</$name>";
                                } else {
                                        $xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val</$name>";
                                }
                                break;
                        case (is_int($val) || is_long($val) || $type == 'int'):
                                if ($use == 'literal') {
                                        $xml .= "<$name$xmlns $atts>$val</$name>";
                                } else {
                                        $xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
                                }
                                break;
                        case (is_float($val)|| is_double($val) || $type == 'float'):
                                if ($use == 'literal') {
                                        $xml .= "<$name$xmlns $atts>$val</$name>";
                                } else {
                                        $xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val</$name>";
                                }
                                break;
                        case (is_string($val) || $type == 'string'):
                                $val = $this->expandEntities($val);
                                if ($use == 'literal') {
                                        $xml .= "<$name$xmlns $atts>$val</$name>";
                                } else {
                                        $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val</$name>";
                                }
                                break;
                        case is_object($val):
                                if (! $name) {
                                        $name = get_class($val);
                                        $this->debug("In serialize_val, used class name $name as element name");
                                } else {
                                        $this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val));
                                }
                                foreach(get_object_vars($val) as $k => $v){
                                        $pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use);
                                }
                                $xml .= '<'.$name.'>'.$pXml.'</'.$name.'>';
                                break;
                        break;
                        case (is_array($val) || $type):
                                // detect if struct or array
                                $valueType = $this->isArraySimpleOrStruct($val);
                if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
                                        $i = 0;
                                        if(is_array($val) && count($val)> 0){
                                                foreach($val as $v){
                                if(is_object($v) && get_class($v) ==  'soapval'){
                                                                $tt_ns = $v->type_ns;
                                                                $tt = $v->type;
                                                        } elseif (is_array($v)) {
                                                                $tt = $this->isArraySimpleOrStruct($v);
                                                        } else {
                                                                $tt = gettype($v);
                                }
                                                        $array_types[$tt] = 1;
                                                        // TODO: for literal, the name should be $name
                                                        $xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
                                                        ++$i;
                                                }
                                                if(count($array_types) > 1){
                                                        $array_typename = 'xsd:anyType';
                                                } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
                                                        if ($tt == 'integer') {
                                                                $tt = 'int';
                                                        }
                                                        $array_typename = 'xsd:'.$tt;
                                                } elseif(isset($tt) && $tt == 'arraySimple'){
                                                        $array_typename = 'SOAP-ENC:Array';
                                                } elseif(isset($tt) && $tt == 'arrayStruct'){
                                                        $array_typename = 'unnamed_struct_use_soapval';
                                                } else {
                                                        // if type is prefixed, create type prefix
                                                        if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
                                                                 $array_typename = 'xsd:' . $tt;
                                                        } elseif ($tt_ns) {
                                                                $tt_prefix = 'ns' . rand(1000, 9999);
                                                                $array_typename = "$tt_prefix:$tt";
                                                                $xmlns .= " xmlns:$tt_prefix=\"$tt_ns\"";
                                                        } else {
                                                                $array_typename = $tt;
                                                        }
                                                }
                                                $array_type = $i;
                                                if ($use == 'literal') {
                                                        $type_str = '';
                                                } else if (isset($type) && isset($type_prefix)) {
                                                        $type_str = " xsi:type=\"$type_prefix:$type\"";
                                                } else {
                                                        $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\"";
                                                }
                                        // empty array
                                        } else {
                                                if ($use == 'literal') {
                                                        $type_str = '';
                                                } else if (isset($type) && isset($type_prefix)) {
                                                        $type_str = " xsi:type=\"$type_prefix:$type\"";
                                                } else {
                                                        $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\"";
                                                }
                                        }
                                        // TODO: for array in literal, there is no wrapper here
                                        $xml = "<$name$xmlns$type_str$atts>".$xml."</$name>";
                                } else {
                                        // got a struct
                                        if(isset($type) && isset($type_prefix)){
                                                $type_str = " xsi:type=\"$type_prefix:$type\"";
                                        } else {
                                                $type_str = '';
                                        }
                                        if ($use == 'literal') {
                                                $xml .= "<$name$xmlns $atts>";
                                        } else {
                                                $xml .= "<$name$xmlns$type_str$atts>";
                                        }
                                        foreach($val as $k => $v){
                                                // Apache Map
                                                if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
                                                        $xml .= '<item>';
                                                        $xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
                                                        $xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
                                                        $xml .= '</item>';
                                                } else {
                                                        $xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
                                                }
                                        }
                                        $xml .= "</$name>";
                                }
                                break;
                        default:
                                $xml .= 'not detected, got '.gettype($val).' for '.$val;
                                break;
                }
                return $xml;
        }

Here is the call graph for this function:

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

serializes PHP values in accordance w/ section 5.

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

Returns:
string public

Definition at line 212 of file nusoap.php.

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

Referenced by soap_client::call(), soap_fault::serialize(), soapval::serialize(), soap_server::serialize_return(), serialize_val(), wsdl::serializeComplexTypeElements(), serializeEnvelope(), and wsdl::serializeType().

                                                                                                                           {
        if(is_object($val) && get_class($val) == 'soapval'){
                return $val->serialize($use);
        }
                $this->debug( "in serialize_val: $val, $name, $type, $name_ns, $type_ns, $attributes, $use");
                // if no name, use item
                $name = (!$name|| is_numeric($name)) ? 'soapVal' : $name;
                // if name has ns, add ns prefix to name
                $xmlns = '';
        if($name_ns){
                        $prefix = 'nu'.rand(1000,9999);
                        $name = $prefix.':'.$name;
                        $xmlns .= " xmlns:$prefix=\"$name_ns\"";
                }
                // if type is prefixed, create type prefix
                if($type_ns != '' && $type_ns == $this->namespaces['xsd']){
                        // need to fix this. shouldn't default to xsd if no ns specified
                    // w/o checking against typemap
                        $type_prefix = 'xsd';
                } elseif($type_ns){
                        $type_prefix = 'ns'.rand(1000,9999);
                        $xmlns .= " xmlns:$type_prefix=\"$type_ns\"";
                }
                // serialize attributes if present
                $atts = '';
                if($attributes){
                        foreach($attributes as $k => $v){
                                $atts .= " $k=\"$v\"";
                        }
                }
        // serialize if an xsd built-in primitive type
        if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
                if (is_bool($val)) {
                        if ($type == 'boolean') {
                                $val = $val ? 'true' : 'false';
                        } elseif (! $val) {
                                $val = 0;
                        }
                        } else if (is_string($val)) {
                                $val = $this->expandEntities($val);
                        }
                        if ($use == 'literal') {
                        return "<$name$xmlns>$val</$name>";
                } else {
                        return "<$name$xmlns xsi:type=\"xsd:$type\">$val</$name>";
                }
        }
                // detect type and serialize
                $xml = '';
                switch(true) {
                        case ($type == '' && is_null($val)):
                                if ($use == 'literal') {
                                        // TODO: depends on nillable
                                        $xml .= "<$name$xmlns/>";
                                } else {
                                        $xml .= "<$name$xmlns xsi:nil=\"true\"/>";
                                }
                                break;
                        case (is_bool($val) || $type == 'boolean'):
                        if ($type == 'boolean') {
                                $val = $val ? 'true' : 'false';
                        } elseif (! $val) {
                                $val = 0;
                        }
                                if ($use == 'literal') {
                                        $xml .= "<$name$xmlns $atts>$val</$name>";
                                } else {
                                        $xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val</$name>";
                                }
                                break;
                        case (is_int($val) || is_long($val) || $type == 'int'):
                                if ($use == 'literal') {
                                        $xml .= "<$name$xmlns $atts>$val</$name>";
                                } else {
                                        $xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
                                }
                                break;
                        case (is_float($val)|| is_double($val) || $type == 'float'):
                                if ($use == 'literal') {
                                        $xml .= "<$name$xmlns $atts>$val</$name>";
                                } else {
                                        $xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val</$name>";
                                }
                                break;
                        case (is_string($val) || $type == 'string'):
                                $val = $this->expandEntities($val);
                                if ($use == 'literal') {
                                        $xml .= "<$name$xmlns $atts>$val</$name>";
                                } else {
                                        $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val</$name>";
                                }
                                break;
                        case is_object($val):
                                $name = get_class($val);
                                foreach(get_object_vars($val) as $k => $v){
                                        $pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use);
                                }
                                $xml .= '<'.$name.'>'.$pXml.'</'.$name.'>';
                                break;
                        break;
                        case (is_array($val) || $type):
                                // detect if struct or array
                                $valueType = $this->isArraySimpleOrStruct($val);
                if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
                                        $i = 0;
                                        if(is_array($val) && count($val)> 0){
                                                foreach($val as $v){
                                if(is_object($v) && get_class($v) ==  'soapval'){
                                                                $tt_ns = $v->type_ns;
                                                                $tt = $v->type;
                                                        } elseif (is_array($v)) {
                                                                $tt = $this->isArraySimpleOrStruct($v);
                                                        } else {
                                                                $tt = gettype($v);
                                }
                                                        $array_types[$tt] = 1;
                                                        $xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
                                                        ++$i;
                                                }
                                                if(count($array_types) > 1){
                                                        $array_typename = 'xsd:ur-type';
                                                } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
                                                        if ($tt == 'integer') {
                                                                $tt = 'int';
                                                        }
                                                        $array_typename = 'xsd:'.$tt;
                                                } elseif(isset($tt) && $tt == 'arraySimple'){
                                                        $array_typename = 'SOAP-ENC:Array';
                                                } elseif(isset($tt) && $tt == 'arrayStruct'){
                                                        $array_typename = 'unnamed_struct_use_soapval';
                                                } else {
                                                        // if type is prefixed, create type prefix
                                                        if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
                                                                 $array_typename = 'xsd:' . $tt;
                                                        } elseif ($tt_ns) {
                                                                $tt_prefix = 'ns' . rand(1000, 9999);
                                                                $array_typename = "$tt_prefix:$tt";
                                                                $xmlns .= " xmlns:$tt_prefix=\"$tt_ns\"";
                                                        } else {
                                                                $array_typename = $tt;
                                                        }
                                                }
                                                $array_type = $i;
                                                if ($use == 'literal') {
                                                        $type_str = '';
                                                } else if (isset($type) && isset($type_prefix)) {
                                                        $type_str = " xsi:type=\"$type_prefix:$type\"";
                                                } else {
                                                        $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\"";
                                                }
                                        // empty array
                                        } else {
                                                if ($use == 'literal') {
                                                        $type_str = '';
                                                } else if (isset($type) && isset($type_prefix)) {
                                                        $type_str = " xsi:type=\"$type_prefix:$type\"";
                                                } else {
                                                        $type_str = " xsi:type=\"SOAP-ENC:Array\"";
                                                }
                                        }
                                        $xml = "<$name$xmlns$type_str$atts>".$xml."</$name>";
                                } else {
                                        // got a struct
                                        if(isset($type) && isset($type_prefix)){
                                                $type_str = " xsi:type=\"$type_prefix:$type\"";
                                        } else {
                                                $type_str = '';
                                        }
                                        if ($use == 'literal') {
                                                $xml .= "<$name$xmlns $atts>";
                                        } else {
                                                $xml .= "<$name$xmlns$type_str$atts>";
                                        }
                                        foreach($val as $k => $v){
                                                // Apache Map
                                                if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
                                                        $xml .= '<item>';
                                                        $xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
                                                        $xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
                                                        $xml .= '</item>';
                                                } else {
                                                        $xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
                                                }
                                        }
                                        $xml .= "</$name>";
                                }
                                break;
                        default:
                                $xml .= 'not detected, got '.gettype($val).' for '.$val;
                                break;
                }
                return $xml;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

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

serializes a message

Parameters:
string $body the XML of the SOAP body
mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers
array $namespaces optional the namespaces used in generating the body and headers
string $style optional (rpc|document)
string $use optional (encoded|literal)
string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
Returns:
string the message public

Definition at line 611 of file nusoap.php.

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

                                                                                                                        ://schemas.xmlsoap.org/soap/encoding/'){
    // TODO: add an option to automatically run utf8_encode on $body and $headers
    // if $this->soap_defencoding is UTF-8.  Not doing this automatically allows
    // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1

        $this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle");
        $this->debug("headers:");
        $this->appendDebug($this->varDump($headers));
        $this->debug("namespaces:");
        $this->appendDebug($this->varDump($namespaces));

        // serialize namespaces
    $ns_string = '';
        foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
                $ns_string .= " xmlns:$k=\"$v\"";
        }
        if($encodingStyle) {
                $ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
        }

        // serialize headers
        if($headers){
                if (is_array($headers)) {
                        $xml = '';
                        foreach ($headers as $header) {
                                $xml .= $this->serialize_val($header, false, false, false, false, false, $use);
                        }
                        $headers = $xml;
                        $this->debug("In serializeEnvelope, serialzied array of headers to $headers");
                }
                $headers = "<SOAP-ENV:Header>".$headers."</SOAP-ENV:Header>";
        }
        // serialize envelope
        return
        '<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
        '<SOAP-ENV:Envelope'.$ns_string.">".
        $headers.
        "<SOAP-ENV:Body>".
                $body.
        "</SOAP-ENV:Body>".
        "</SOAP-ENV:Envelope>";
    }

Here is the call graph for this function:

nusoap_base::serializeEnvelope ( body,
headers = false,
namespaces = array(),
style = 'rpc',
use = 'encoded' 
)

serialize message

Parameters:
string body
string headers optional
array namespaces optional
string style optional (rpc|document)
string use optional (encoded|literal)
Returns:
string message public

Definition at line 417 of file nusoap.php.

References $namespaces.

Referenced by soap_client::call(), and soap_server::serialize_return().

                                                                                                    {
    // TODO: add an option to automatically run utf8_encode on $body and $headers
    // if $this->soap_defencoding is UTF-8.  Not doing this automatically allows
    // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1

        // serialize namespaces
    $ns_string = '';
        foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
                $ns_string .= " xmlns:$k=\"$v\"";
        }
        if($style == 'rpc' && $use == 'encoded') {
                $ns_string = ' SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"' . $ns_string;
        }

        // serialize headers
        if($headers){
                $headers = "<SOAP-ENV:Header>".$headers."</SOAP-ENV:Header>";
        }
        // serialize envelope
        return
        '<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
        '<SOAP-ENV:Envelope'.$ns_string.">".
        $headers.
        "<SOAP-ENV:Body>".
                $body.
        "</SOAP-ENV:Body>".
        "</SOAP-ENV:Envelope>";
    }

Here is the caller graph for this function:

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

serializes a message

Parameters:
string $body the XML of the SOAP body
mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers
array $namespaces optional the namespaces used in generating the body and headers
string $style optional (rpc|document)
string $use optional (encoded|literal)
string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
Returns:
string the message public

Definition at line 611 of file class.nusoap_base.php.

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

                                                                                                                        ://schemas.xmlsoap.org/soap/encoding/'){
    // TODO: add an option to automatically run utf8_encode on $body and $headers
    // if $this->soap_defencoding is UTF-8.  Not doing this automatically allows
    // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1

        $this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle");
        $this->debug("headers:");
        $this->appendDebug($this->varDump($headers));
        $this->debug("namespaces:");
        $this->appendDebug($this->varDump($namespaces));

        // serialize namespaces
    $ns_string = '';
        foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
                $ns_string .= " xmlns:$k=\"$v\"";
        }
        if($encodingStyle) {
                $ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
        }

        // serialize headers
        if($headers){
                if (is_array($headers)) {
                        $xml = '';
                        foreach ($headers as $header) {
                                $xml .= $this->serialize_val($header, false, false, false, false, false, $use);
                        }
                        $headers = $xml;
                        $this->debug("In serializeEnvelope, serialzied array of headers to $headers");
                }
                $headers = "<SOAP-ENV:Header>".$headers."</SOAP-ENV:Header>";
        }
        // serialize envelope
        return
        '<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
        '<SOAP-ENV:Envelope'.$ns_string.">".
        $headers.
        "<SOAP-ENV:Body>".
                $body.
        "</SOAP-ENV:Body>".
        "</SOAP-ENV:Envelope>";
    }

Here is the call graph for this function:

nusoap_base::setDebugLevel ( level  ) 

sets the debug level for this instance

Parameters:
int $level Debug level 0-9, where 0 turns off public

Definition at line 245 of file class.nusoap_base.php.

                                       {
                $this->debugLevel = $level;
        }

nusoap_base::setDebugLevel ( level  ) 

sets the debug level for this instance

Parameters:
int $level Debug level 0-9, where 0 turns off public

Definition at line 245 of file nusoap.php.

                                       {
                $this->debugLevel = $level;
        }

nusoap_base::setError ( str  ) 
nusoap_base::setError ( str  ) 

sets error string

Returns:
boolean $string error string private

Definition at line 350 of file class.nusoap_base.php.

                               {
                $this->error_str = $str;
        }

nusoap_base::setError ( str  ) 

sets error string

Returns:
boolean $string error string private

Definition at line 350 of file nusoap.php.

                               {
                $this->error_str = $str;
        }

nusoap_base::setGlobalDebugLevel ( level  ) 

sets the global debug level, which applies to future instances

Parameters:
int $level Debug level 0-9, where 0 turns off public

Definition at line 225 of file class.nusoap_base.php.

References $GLOBALS.

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

nusoap_base::setGlobalDebugLevel ( level  ) 

sets the global debug level, which applies to future instances

Parameters:
int $level Debug level 0-9, where 0 turns off public

Definition at line 225 of file nusoap.php.

References $GLOBALS.

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

nusoap_base::varDump ( data  ) 

Returns a string with the output of var_dump.

Parameters:
mixed $data The variable to var_dump
Returns:
string The output of var_dump public

Definition at line 807 of file class.nusoap_base.php.

References $data.

                            {
                ob_start();
                var_dump($data);
                $ret_val = ob_get_contents();
                ob_end_clean();
                return $ret_val;
        }

nusoap_base::varDump ( data  ) 
nusoap_base::varDump ( data  ) 

Returns a string with the output of var_dump.

Parameters:
mixed $data The variable to var_dump
Returns:
string The output of var_dump public

Definition at line 807 of file nusoap.php.

References $data.

                            {
                ob_start();
                var_dump($data);
                $ret_val = ob_get_contents();
                ob_end_clean();
                return $ret_val;
        }


Field Documentation

nusoap_base::$charencoding = true

Definition at line 70 of file nusoap.php.

nusoap_base::$debug_str = ''

Definition at line 67 of file nusoap.php.

nusoap_base::$debugLevel

Definition at line 115 of file class.nusoap_base.php.

nusoap_base::$error_str = false

Reimplemented in soap_client.

Definition at line 66 of file nusoap.php.

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/',
                'si' => 'http://soapinterop.org/xsd')

Reimplemented in soap_parser.

Definition at line 95 of file nusoap.php.

Referenced by serializeEnvelope(), and XMLSchema::XMLSchema().

nusoap_base::$revision = '$Revision: 11808 $'

Definition at line 65 of file nusoap.php.

nusoap_base::$soap_defencoding = 'UTF-8'

Definition at line 86 of file nusoap.php.

nusoap_base::$title = 'NuSOAP'

Definition at line 63 of file nusoap.php.

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',
                
                '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/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 110 of file nusoap.php.

nusoap_base::$usedNamespaces = array()

Definition at line 101 of file nusoap.php.

Referenced by soap_client::call().

nusoap_base::$version = '0.6.7'

Definition at line 64 of file nusoap.php.

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

Definition at line 135 of file nusoap.php.

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

Definition at line 78 of file nusoap.php.


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