Index: branches/version-2_12-dev/data/module/SOAP/Server/TCP/Handler.php
===================================================================
--- branches/version-2_12-dev/data/module/SOAP/Server/TCP/Handler.php	(revision 21461)
+++ branches/version-2_12-dev/data/module/SOAP/Server/TCP/Handler.php	(revision 21461)
@@ -0,0 +1,77 @@
+<?php
+/**
+ * This file contains the code for the TCP SOAP server.
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 2.02 of the PHP license,
+ * that is bundled with this package in the file LICENSE, and is available at
+ * through the world-wide-web at http://www.php.net/license/2_02.txt.  If you
+ * did not receive a copy of the PHP license and are unable to obtain it
+ * through the world-wide-web, please send a note to license@php.net so we can
+ * mail you a copy immediately.
+ *
+ * @category   Web Services
+ * @package    SOAP
+ * @author     Tomasz Rup <tomasz.rup@gmail.com>
+ * @copyright  2003-2005 The PHP Group
+ * @license    http://www.php.net/license/2_02.txt  PHP License 2.02
+ * @link       http://pear.php.net/package/SOAP
+ */
+
+/**
+ * server base class
+ */
+require_once 'Net/Server.php';
+
+/**
+ * base class for the handler
+ */
+require_once 'Net/Server/Handler.php';
+
+
+/**
+ * SOAP Server Class that implements a TCP SOAP Server.
+ * http://www.pocketsoap.com/specs/smtpbinding/
+ *
+ * This class overrides the default HTTP server, providing the ability to
+ * accept socket connections and execute SOAP calls.
+ *
+ * @access   public
+ * @package  SOAP
+ * @author   Tomasz Rup <tomasz.rup@gmail.com>
+ */
+class SOAP_Server_TCP_Handler extends Net_Server_Handler {
+
+    var $_SOAP_Server;
+
+    function setSOAPServer(&$server)
+    {
+        $this->_SOAP_Server =& $server;
+    }
+    
+    /**
+     * If the user sends data, send it back to him
+     *
+     * @access   public
+     * @param    integer $clientId
+     * @param    string  $data
+     */
+    function onReceiveData($clientId = 0, $data = '')
+    {
+        if (trim($data) <> '') {
+            $response = $this->_SOAP_Server->service($data);
+            $this->_server->sendData($clientId, $response);
+        }
+    }
+    
+    function onStart()
+    {
+        $this->_SOAP_Server->onStart();
+    }
+    
+    function onIdle()
+    {
+        $this->_SOAP_Server->onIdle();
+    }
+}
Index: branches/version-2_12-dev/data/module/SOAP/Server/TCP.php
===================================================================
--- branches/version-2_12-dev/data/module/SOAP/Server/TCP.php	(revision 20119)
+++ branches/version-2_12-dev/data/module/SOAP/Server/TCP.php	(revision 21461)
@@ -22,4 +22,7 @@
 require_once 'SOAP/Server.php';
 
+require_once 'SOAP/Server/TCP/Handler.php';
+
+
 /**
  * SOAP Server Class that implements a TCP SOAP Server.
@@ -43,58 +46,33 @@
     var $localaddr;
     var $port;
-    var $listen;
-    var $reuse;
+    var $type;
 
     function SOAP_Server_TCP($localaddr = '127.0.0.1', $port = 10000,
-                             $listen = 5, $reuse = true)
+                             $type = 'sequential')
     {
         parent::SOAP_Server();
         $this->localaddr = $localaddr;
         $this->port = $port;
-        $this->listen = $listen;
-        $this->reuse = $reuse;
+        $this->type = $type;
     }
 
-    function run()
-    {
-        if (($sock = socket_create(AF_INET, SOCK_STREAM, 0)) < 0) {
-            return $this->_raiseSoapFault('socket_create() failed. Reason: ' . socket_strerror($sock));
+    function run($idleTimeout = null)
+    {        
+        $server = &Net_Server::create($this->type, $this->localaddr,
+                                      $this->port);
+        if (PEAR::isError($server)) {
+            echo $server->getMessage()."\n";
         }
-        if ($this->reuse &&
-            !@socket_setopt($sock, SOL_SOCKET, SO_REUSEADDR, 1)) {
-            return $this->_raiseSoapFault('socket_setopt() failed. Reason: ' . socket_strerror(socket_last_error($sock)));
-        }
-        if (($ret = socket_bind($sock, $this->localaddr, $this->port)) < 0) {
-            return $this->_raiseSoapFault('socket_bind() failed. Reason: ' . socket_strerror($ret));
-        }
-        if (($ret = socket_listen($sock, $this->listen)) < 0) {
-            return $this->_raiseSoapFault('socket_listen() failed. Reason: ' . socket_strerror($ret));
-        }
-
-        while (true) {
-            $data = null;
-            if (($msgsock = socket_accept($sock)) < 0) {
-                $this->_raiseSoapFault('socket_accept() failed. Reason: ' . socket_strerror($msgsock));
-                break;
-            }
-            while ($buf = socket_read($msgsock, 8192)) {
-                if (!$buf = trim($buf)) {
-                    continue;
-                }
-                $data .= $buf;
-            }
-
-            if ($data) {
-                $response = $this->service($data);
-                /* Write to the socket. */
-                if (!socket_write($msgsock, $response, strlen($response))) {
-                    return $this->_raiseSoapFault('Error sending response data reason ' . socket_strerror());
-                }
-            }
-
-            socket_close ($msgsock);
-        }
-
-        socket_close ($sock);
+        
+        $handler = &new SOAP_Server_TCP_Handler;
+        $handler->setSOAPServer($this);
+        
+        // hand over the object that handles server events
+        $server->setCallbackObject($handler);
+        $server->readEndCharacter = '</SOAP-ENV:Envelope>';
+        $server->setIdleTimeout($idleTimeout);
+        
+        // start the server
+        $server->start();
     }
 
@@ -102,5 +80,17 @@
     {
         /* TODO: we need to handle attachments somehow. */
-        return $this->parseRequest($data, $attachments);
+        $response = $this->parseRequest($data);
+        if ($this->fault) {
+            $response = $this->fault->message($this->response_encoding);
+        }
+        return $response;
+    }
+    
+    function onStart()
+    {
+    }
+    
+    function onIdle()
+    {
     }
 }
Index: branches/version-2_12-dev/data/module/SOAP/Server/Email.php
===================================================================
--- branches/version-2_12-dev/data/module/SOAP/Server/Email.php	(revision 21318)
+++ branches/version-2_12-dev/data/module/SOAP/Server/Email.php	(revision 21461)
@@ -118,5 +118,5 @@
         }
 
-        $client =& new SOAP_Client(null);
+        $client = new SOAP_Client(null);
 
         return $client->parseResponse($data, $this->xml_encoding, $this->attachments);
Index: branches/version-2_12-dev/data/module/SOAP/Disco.php
===================================================================
--- branches/version-2_12-dev/data/module/SOAP/Disco.php	(revision 21318)
+++ branches/version-2_12-dev/data/module/SOAP/Disco.php	(revision 21461)
@@ -367,5 +367,5 @@
             }
             $typens = $this->namespaces[$m[1][0]];
-            $type = ereg_replace($m[0][0],'',$type);
+            $type = preg_replace('/'.$m[0][0].'/', '', $type);
         } else {
             $typens = 'xsd';
Index: branches/version-2_12-dev/data/module/SOAP/Server.php
===================================================================
--- branches/version-2_12-dev/data/module/SOAP/Server.php	(revision 21318)
+++ branches/version-2_12-dev/data/module/SOAP/Server.php	(revision 21461)
@@ -295,4 +295,5 @@
 
         foreach ($this->headers as $k => $v) {
+            $v = str_replace(array("\r", "\n"), '', $v);
             header("$k: $v");
             $hdrs .= "$k: $v\r\n";
@@ -598,6 +599,11 @@
                 $map = $this->soapobject->__dispatch($this->methodname);
             } elseif (method_exists($this->soapobject, $this->methodname)) {
-                /* No map, all public functions are SOAP functions. */
-                return true;
+                if (isset($this->soapobject->__dispatch_map[$this->methodname])) {
+                    // pdp - 2011-04-29 - declared output will be copied to return_type and use in buildResult
+                    $map = $this->soapobject->__dispatch_map[$this->methodname];
+                } else {
+                    /* No map, all public functions are SOAP functions. */
+                    return true;
+                }
             }
         }
Index: branches/version-2_12-dev/data/module/SOAP/Transport/HTTP.php
===================================================================
--- branches/version-2_12-dev/data/module/SOAP/Transport/HTTP.php	(revision 21318)
+++ branches/version-2_12-dev/data/module/SOAP/Transport/HTTP.php	(revision 21461)
@@ -270,11 +270,11 @@
         /* Largely borrowed from HTTP_Request. */
         $this->result_headers = array();
-        $headers = split("\r?\n", $headers);
+        $headers = preg_split("/\r?\n/", $headers);
         foreach ($headers as $value) {
-            if (strpos($value,':') === false) {
+            if (strpos($value, ':') === false) {
                 $this->result_headers[0] = $value;
                 continue;
             }
-            list($name, $value) = split(':', $value);
+            list($name, $value) = explode(':', $value);
             $headername = strtolower($name);
             $headervalue = trim($value);
@@ -343,11 +343,11 @@
 
         switch($code) {
-            case 100: // Continue
+            // Continue
+            case 100:
                 $this->incoming_payload = $match[2];
                 return $this->_parseResponse();
             case 200:
             case 202:
-                $this->incoming_payload = trim($match[2]);
-                if (!strlen($this->incoming_payload)) {
+                if (!strlen(trim($match[2]))) {
                     /* Valid one-way message response. */
                     return true;
Index: branches/version-2_12-dev/data/module/SOAP/WSDL.php
===================================================================
--- branches/version-2_12-dev/data/module/SOAP/WSDL.php	(revision 21318)
+++ branches/version-2_12-dev/data/module/SOAP/WSDL.php	(revision 21461)
@@ -212,5 +212,5 @@
     function parseURL($wsdl_uri)
     {
-        $parser =& new $this->wsdlParserClass($wsdl_uri, $this, $this->docs);
+        $parser = new $this->wsdlParserClass($wsdl_uri, $this, $this->docs);
 
         if ($parser->fault) {
@@ -332,4 +332,9 @@
         // Message data from messages.
         $inputMsg = $opData['input']['message'];
+        if (isset($opData['input']['parts']) &&
+            !is_array($opData['input']['parts'])) {
+            $opData['input']['parts'] = array($opData['input']['parts'] => '');
+
+        }
         if (is_array($this->messages[$inputMsg])) {
             foreach ($this->messages[$inputMsg] as $pname => $pattrs) {
@@ -351,4 +356,8 @@
         }
         $outputMsg = $opData['output']['message'];
+        if (isset($opData['output']['parts']) &&
+            !is_array($opData['output']['parts'])) {
+            $opData['output']['parts'] = array($opData['output']['parts'] => '');
+        }
         if (is_array($this->messages[$outputMsg])) {
             foreach ($this->messages[$outputMsg] as $pname => $pattrs) {
@@ -789,5 +798,5 @@
             eval($proxy);
         }
-        $proxy =& new $classname;
+        $proxy = new $classname;
 
         return $proxy;
@@ -939,5 +948,5 @@
         static $trail = array();
 
-        $arrayType = ereg_replace('\[\]$', '', $arrayType);
+        $arrayType = preg_replace('/\[\]$/', '', $arrayType);
 
         // Protect against circular references XXX We really need to remove
@@ -1157,5 +1166,5 @@
     {
         parent::SOAP_Base('WSDLPARSER');
-        $this->cache =& new SOAP_WSDL_Cache($wsdl->cacheUse,
+        $this->cache = new SOAP_WSDL_Cache($wsdl->cacheUse,
                                             $wsdl->cacheMaxAge,
                                             $wsdl->cacheDir);
@@ -1200,6 +1209,6 @@
         // Get element prefix.
         $qname = new QName($name);
-        if ($qname->ns) {
-            $ns = $qname->ns;
+        if ($qname->prefix) {
+            $ns = $qname->prefix;
             if ($ns && ((!$this->tns && strcasecmp($qname->name, 'definitions') == 0) || $ns == $this->tns)) {
                 $name = $qname->name;
@@ -1249,5 +1258,5 @@
                         $qn = new QName($attrs['base']);
                         $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = $qn->name;
-                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['namespace'] = $qn->ns;
+                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['namespace'] = $qn->prefix;
                     } else {
                         $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Struct';
@@ -1263,6 +1272,6 @@
                     $qn = new QName($attrs['type']);
                     $attrs['type'] = $qn->name;
-                    if ($qn->ns && array_key_exists($qn->ns, $this->wsdl->namespaces)) {
-                        $attrs['namespace'] = $qn->ns;
+                    if ($qn->prefix && array_key_exists($qn->prefix, $this->wsdl->namespaces)) {
+                        $attrs['namespace'] = $qn->prefix;
                     }
                 }
@@ -1362,5 +1371,5 @@
                                         $this->wsdl->complexTypes[$this->schema][$this->currentComplexType][$q->name] = $vq->name. $vq->arrayInfo;
                                         $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Array';
-                                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['namespace'] = $vq->ns;
+                                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['namespace'] = $vq->prefix;
                                     } else {
                                         $this->wsdl->complexTypes[$this->schema][$this->currentComplexType][$q->name] = $vq->name;
@@ -1389,5 +1398,5 @@
                 if ($qn) {
                     $attrs['type'] = $qn->name;
-                    $attrs['namespace'] = $qn->ns;
+                    $attrs['namespace'] = $qn->prefix;
                 }
                 $this->wsdl->messages[$this->currentMessage][$attrs['name']] = $attrs;
@@ -1426,5 +1435,5 @@
                         $qn = new QName($attrs['message']);
                         $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['message'] = $qn->name;
-                        $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['namespace'] = $qn->ns;
+                        $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['namespace'] = $qn->prefix;
                     }
                 }
@@ -1440,5 +1449,5 @@
 
         case 'binding':
-            $ns = $qname->ns ? $this->wsdl->namespaces[$qname->ns] : SCHEMA_WSDL;
+            $ns = $qname->prefix ? $this->wsdl->namespaces[$qname->prefix] : SCHEMA_WSDL;
             switch ($ns) {
             case SCHEMA_SOAP:
@@ -1627,5 +1636,5 @@
 
         case 'service':
-            $ns = $qname->ns ? $this->wsdl->namespaces[$qname->ns] : SCHEMA_WSDL;
+            $ns = $qname->prefix ? $this->wsdl->namespaces[$qname->prefix] : SCHEMA_WSDL;
 
             switch ($qname->name) {
@@ -1637,5 +1646,5 @@
                 $qn = new QName($attrs['binding']);
                 $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['binding'] = $qn->name;
-                $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['namespace'] = $qn->ns;
+                $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['namespace'] = $qn->prefix;
                 break;
 
@@ -1643,5 +1652,5 @@
                 $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['address'] = $attrs;
                 // what TYPE of port is it?  SOAP or HTTP?
-                $ns = $qname->ns ? $this->wsdl->namespaces[$qname->ns] : SCHEMA_WSDL;
+                $ns = $qname->prefix ? $this->wsdl->namespaces[$qname->prefix] : SCHEMA_WSDL;
                 switch ($ns) {
                 case SCHEMA_WSDL_HTTP:
@@ -1671,7 +1680,9 @@
         switch ($qname->name) {
         case 'import':
-            // sect 2.1.1 wsdl:import attributes: namespace location
-            if ((isset($attrs['location']) || isset($attrs['schemaLocation'])) &&
-                !isset($this->wsdl->imports[$attrs['namespace']])) {
+        case 'include':
+            // WSDL 2.1.1 wsdl:import, XML Schema 4.2.3 xsd:import, XML Schema
+            // 4.2.1 xsd:include attributes
+            $this->status = 'types';
+            if (isset($attrs['location']) || isset($attrs['schemaLocation'])) {
                 $uri = isset($attrs['location']) ? $attrs['location'] : $attrs['schemaLocation'];
                 $location = @parse_url($uri);
@@ -1680,16 +1691,18 @@
                     $uri = $this->mergeUrl($base, $uri);
                 }
-
-                $this->wsdl->imports[$attrs['namespace']] = $attrs;
+                if (isset($this->wsdl->imports[$uri])) {
+                    break;
+                }
+                $this->wsdl->imports[$uri] = $attrs;
+
                 $import_parser_class = get_class($this);
-                $import_parser =& new $import_parser_class($uri, $this->wsdl, $this->docs);
+                $import_parser = new $import_parser_class($uri, $this->wsdl, $this->docs);
                 if ($import_parser->fault) {
-                    unset($this->wsdl->imports[$attrs['namespace']]);
+                    unset($this->wsdl->imports[$uri]);
                     return false;
                 }
-                $this->currentImport = $attrs['namespace'];
-            }
-            // Continue on to the 'types' case - lack of break; is
-            // intentional.
+            }
+            $this->status = 'types';
+            break;
 
         case 'types':
@@ -1733,5 +1746,5 @@
             // sect 2.5 wsdl:binding attributes: name type
             // children: wsdl:operation soap:binding http:binding
-            if ($qname->ns && $qname->ns != $this->tns) {
+            if ($qname->prefix && $qname->prefix != $this->tns) {
                 break;
             }
@@ -1740,5 +1753,5 @@
             $qn = new QName($attrs['type']);
             $this->wsdl->bindings[$this->currentBinding]['type'] = $qn->name;
-            $this->wsdl->bindings[$this->currentBinding]['namespace'] = $qn->ns;
+            $this->wsdl->bindings[$this->currentBinding]['namespace'] = $qn->prefix;
             break;
 
Index: branches/version-2_12-dev/data/module/SOAP/Base.php
===================================================================
--- branches/version-2_12-dev/data/module/SOAP/Base.php	(revision 21318)
+++ branches/version-2_12-dev/data/module/SOAP/Base.php	(revision 21461)
@@ -37,6 +37,6 @@
 }
 
-define('SOAP_LIBRARY_VERSION', '0.12.0');
-define('SOAP_LIBRARY_NAME',    'PEAR-SOAP 0.12.0-beta');
+define('SOAP_LIBRARY_VERSION', '@version@');
+define('SOAP_LIBRARY_NAME',    'PEAR-SOAP @version@-beta');
 
 // Set schema version.
@@ -68,5 +68,4 @@
 class SOAP_Base_Object extends PEAR
 {
-
     /**
      * Supported encodings, limited by XML extension.
@@ -791,5 +790,5 @@
                     if ($this->_wsdl) {
                         // Get this child's WSDL information.
-                        // /$soapval->ns/$soapval->type/$item->ns/$item->name
+                        // /$soapval->prefix/$soapval->type/$item->prefix/$item->name
                         $child_type = $this->_wsdl->getComplexTypeChildType(
                             $soapval->namespace,
@@ -824,5 +823,9 @@
                             $return = array($return->{$item->name}, $d);
                         } else {
-                            $return->{$item->name} = array($return->{$item->name}, $d);
+                            if (is_array($return->{$item->name})) {
+                                $return->{$item->name} = array_merge($return->{$item->name}, array($d));
+                            } else {
+                                $return->{$item->name} = array($return->{$item->name}, $d);
+                            }
                         }
                     } else {
@@ -1007,5 +1010,5 @@
             $data = $structure->body;
             $headers = $structure->headers;
-
+            unset($headers['']);
             return;
         } elseif (isset($structure->parts)) {
@@ -1013,4 +1016,5 @@
             $headers = array_merge($structure->headers,
                                    $structure->parts[0]->headers);
+            unset($headers['']);
             if (count($structure->parts) <= 1) {
                 return;
@@ -1099,5 +1103,5 @@
 {
     var $name = '';
-    var $ns = '';
+    var $prefix = '';
     var $namespace = '';
 
@@ -1110,7 +1114,6 @@
         } elseif (substr_count($name, ':') == 1) {
             $s = explode(':', $name);
-            $s = array_reverse($s);
-            $this->name = $s[0];
-            $this->ns = $s[1];
+            $this->prefix = $s[0];
+            $this->name = $s[1];
             $this->namespace = $namespace;
         } else {
@@ -1134,6 +1137,6 @@
         if ($this->namespace) {
             return '{' . $this->namespace . '}' . $this->name;
-        } elseif ($this->ns) {
-            return $this->ns . ':' . $this->name;
+        } elseif ($this->prefix) {
+            return $this->prefix . ':' . $this->name;
         }
         return $this->name;
Index: branches/version-2_12-dev/data/module/SOAP/Type/duration.php
===================================================================
--- branches/version-2_12-dev/data/module/SOAP/Type/duration.php	(revision 21318)
+++ branches/version-2_12-dev/data/module/SOAP/Type/duration.php	(revision 21461)
@@ -142,5 +142,5 @@
     function duration_to_unix($duration)
     {
-        if (ereg('(-)?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?T?([0-9]+H)?([0-9]+M)?([0-9]+S)?', $duration, $regs)) {
+        if (preg_match('/(-)?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?T?([0-9]+H)?([0-9]+M)?([0-9]+S)?/', $duration, $regs)) {
             return SOAP_Type_duration::mkduration($regs[1], $regs[2], $regs[3], $regs[4], $regs[5], $regs[6], $regs[7]);
         }
@@ -150,5 +150,5 @@
     function is_duration($duration)
     {
-        return ereg('(-)?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?T?([0-9]+H)?([0-9]+M)?([0-9]+S)?', $duration, $regs);
+        return preg_match('/(-)?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?T?([0-9]+H)?([0-9]+M)?([0-9]+S)?/', $duration, $regs);
     }
 
Index: branches/version-2_12-dev/data/module/SOAP/Parser.php
===================================================================
--- branches/version-2_12-dev/data/module/SOAP/Parser.php	(revision 21318)
+++ branches/version-2_12-dev/data/module/SOAP/Parser.php	(revision 21461)
@@ -343,5 +343,5 @@
             // namespaces.
             $kqn = new QName($key);
-            if ($kqn->ns == 'xmlns') {
+            if ($kqn->prefix == 'xmlns') {
                 $prefix = $kqn->name;
 
@@ -354,5 +354,5 @@
             // Set method namespace.
             } elseif ($key == 'xmlns') {
-                $qname->ns = $this->_getNamespacePrefix($value);
+                $qname->prefix = $this->_getNamespacePrefix($value);
                 $qname->namespace = $value;
             } elseif ($kqn->name == 'actor') {
@@ -365,5 +365,5 @@
                 $vqn = new QName($value);
                 $this->message[$pos]['type'] = $vqn->name;
-                $this->message[$pos]['type_namespace'] = $this->_getNamespaceForPrefix($vqn->ns);
+                $this->message[$pos]['type_namespace'] = $this->_getNamespaceForPrefix($vqn->prefix);
 
                 // Should do something here with the namespace of specified
@@ -379,5 +379,5 @@
 
             } elseif ($kqn->name == 'offset') {
-                $this->message[$pos]['arrayOffset'] = split(',', substr($value, 1, strlen($value) - 2));
+                $this->message[$pos]['arrayOffset'] = explode(',', substr($value, 1, strlen($value) - 2));
 
             } elseif ($kqn->name == 'id') {
@@ -410,8 +410,8 @@
         }
         // See if namespace is defined in tag.
-        if (isset($attrs['xmlns:' . $qname->ns])) {
-            $namespace = $attrs['xmlns:' . $qname->ns];
-        } elseif ($qname->ns && !$qname->namespace) {
-            $namespace = $this->_getNamespaceForPrefix($qname->ns);
+        if (isset($attrs['xmlns:' . $qname->prefix])) {
+            $namespace = $attrs['xmlns:' . $qname->prefix];
+        } elseif ($qname->prefix && !$qname->namespace) {
+            $namespace = $this->_getNamespaceForPrefix($qname->prefix);
         } else {
             // Get namespace.
Index: branches/version-2_12-dev/data/module/SOAP/Value.php
===================================================================
--- branches/version-2_12-dev/data/module/SOAP/Value.php	(revision 21318)
+++ branches/version-2_12-dev/data/module/SOAP/Value.php	(revision 21461)
@@ -139,9 +139,7 @@
         $this->name = $this->nqn->name;
         $this->namespace = $this->nqn->namespace;
-        if ($type) {
-            $this->tqn = new QName($type);
-            $this->type = $this->tqn->name;
-            $this->type_namespace = $this->tqn->namespace;
-        }
+        $this->tqn = new QName($type);
+        $this->type = $this->tqn->name;
+        $this->type_namespace = $this->tqn->namespace;
         $this->value = $value;
         $this->attributes = $attributes;
Index: branches/version-2_12-dev/data/module/SOAP/Client.php
===================================================================
--- branches/version-2_12-dev/data/module/SOAP/Client.php	(revision 21318)
+++ branches/version-2_12-dev/data/module/SOAP/Client.php	(revision 21461)
@@ -606,6 +606,6 @@
                             // the type namespace from WSDL.
                             $qname = new QName($part['type']);
-                            if ($qname->ns) {
-                                $type_namespace = $this->_wsdl->namespaces[$qname->ns];
+                            if ($qname->prefix) {
+                                $type_namespace = $this->_wsdl->namespaces[$qname->prefix];
                             } elseif (isset($part['namespace'])) {
                                 $type_namespace = $this->_wsdl->namespaces[$part['namespace']];
Index: branches/version-2_12-dev/data/module/SOAP/package.xml
===================================================================
--- branches/version-2_12-dev/data/module/SOAP/package.xml	(revision 20119)
+++ 	(revision )
@@ -1,140 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<package packagerversion="1.6.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
- <name>SOAP</name>
- <channel>pear.php.net</channel>
- <summary>SOAP Client/Server for PHP</summary>
- <description>Implementation of SOAP protocol and services</description>
- <lead>
-  <name>Jan Schneider</name>
-  <user>yunosh</user>
-  <email>jan@horde.org</email>
-  <active>yes</active>
- </lead>
- <lead>
-  <name>Chuck Hagenbuch</name>
-  <user>chagenbu</user>
-  <email>chuck@horde.org</email>
-  <active>no</active>
- </lead>
- <lead>
-  <name>Shane Caraveo</name>
-  <user>shane</user>
-  <email>shane@php.net</email>
-  <active>no</active>
- </lead>
- <lead>
-  <name>Al Baker</name>
-  <user>abaker</user>
-  <email>abaker@php.net</email>
-  <active>no</active>
- </lead>
- <lead>
-  <name>Arnaud Limbourg</name>
-  <user>arnaud</user>
-  <email>arnaud@php.net</email>
-  <active>no</active>
- </lead>
- <date>2007-06-29</date>
- <time>17:11:23</time>
- <version>
-  <release>0.11.0</release>
-  <api>0.11.0</api>
- </version>
- <stability>
-  <release>beta</release>
-  <api>beta</api>
- </stability>
- <license uri="http://www.php.net/license">PHP License</license>
- <notes>* Remove SOAP_RAW_CONVERT and SOAP_OBJECT_STRUCT settings.
-* Don&apos;t decode base64 encoded data automatically to be consistent with other encodings like hexBinary that aren&apos;t decoded either (Bug #9840).
-* Always close HTTP connections on requests to avoid keep-alive request (Maik Greubel, Bug #11123).
-* Fix serializing of arrays (Bugs #10283, #10635).
-* Fix MIME type quoting when using MIME attachments (Bug #10023).
-* Fix values of multiple arrays in result object being dismissed on SOAP to PHP-object conversion (Christian Weiske, Bug #2627).
-* Fix wrong Content-Type header on HTTPS requests (Christian Weiske, Bug #6213).
-* Fix empty arrays in SOAP responses being converted to empty string instead of empty array (Christian Weiske, Bug #10131).
-* Fix timezones in Type/dateTime.php not being converted correctly (Christian Weiske, Bug #10206).</notes>
- <contents>
-  <dir baseinstalldir="SOAP" name="/">
-   <file baseinstalldir="SOAP" md5sum="9559e379c3becea8aeee54b914423854" name="example/attachment.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="b020797e29e8e64376c0c07ef75e0213" name="example/client.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="fc8a7de5818fc0c90793fde12ca0ca63" name="example/com_client.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="2b413f1e68aab19fbb75fdc5f8b9c0e8" name="example/disco_server.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="a9c530db7dd292c74c4e52d74b703e4e" name="example/email_client.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="9c5f82116808ff9bf712dd1e8b1926ad" name="example/email_gateway.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="bd8bdced809cfce44a6a2b3c2fd0e7ee" name="example/email_pop_gateway.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="feb3535b72a820095e71794784bef51a" name="example/email_pop_server.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="3c3b91a5833b265803efc1f13be8bb25" name="example/email_server.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="5e0a9c93d55bab8ca49a3618b7745e99" name="example/example_server.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="6b209f62024135e5939a34d6c08f3c14" name="example/example_types.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="0c5fe107da15351c51d458b4d11704cc" name="example/server.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="f43e9c93d8f3dcc4c8db335add85052c" name="example/server2.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="dad27403ba186d6f28588b690b695d34" name="example/smtp.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="58d8c6715bc962a7cb2f6485a38a6294" name="example/stockquote.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="9170adaf7ac611d5592636d1cb3ba020" name="example/tcp_client.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="ccc9acb5b161dd84ccec6d19a5579b59" name="example/tcp_daemon.pl" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="e5d8dc13139bcb5951aad270b37dd515" name="example/tcp_server.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="33c0068eaa6f21f209b8c93525824642" name="example/wsdl_client.php" role="doc" />
-   <file baseinstalldir="SOAP" md5sum="43b5245ae178f28c3dc78f3cff584299" name="Server/Email.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="506481286f6a94aaa6d592249bb6fe4e" name="Server/Email_Gateway.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="b8424ce597eb3eaee849a1ae951a36c0" name="Server/TCP.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="1c525226171b9b99966b4ed3eb7373f8" name="tools/genproxy.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="bacf397ba0e1569f542b72cb7c152cc3" name="Transport/HTTP.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="5a20d622c55bbf2e6304abb93bed34c7" name="Transport/SMTP.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="18b2224fe5c4ca3bc679d0d5d2601fe7" name="Transport/TCP.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="75bf753d4cceb4a16a9d0c40ee3f6dcf" name="Type/dateTime.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="57f91357f69e236ada838a2c7de35c70" name="Type/duration.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="16796001ac468d58c537dde94113bf12" name="Type/hexBinary.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="de2892f3c51856a37372127e9fd14617" name="Base.php" role="php">
-    <tasks:replace from="@version@" to="version" type="package-info" />
-   </file>
-   <file baseinstalldir="SOAP" md5sum="75299ff975d014ff037cac43d97d0796" name="Client.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="bca057623598956b278b4077571f7805" name="Disco.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="37309521cf2ec329d8ccfe6644ae8d8e" name="Fault.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="19bdf70d5f921b8cc85c8063a5541c43" name="Parser.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="27e6e319d92d9fa0aa1d1432f7f16c5d" name="Server.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="fa7376f1c015da685a6534f9cd483d6c" name="Transport.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="d3cfdea9ee3d97736fe3c881bc498f2d" name="Value.php" role="php" />
-   <file baseinstalldir="SOAP" md5sum="62a9ddff55d489dc2943d35a47421e6d" name="WSDL.php" role="php" />
-  </dir>
- </contents>
- <compatible>
-  <name>Services_Weather</name>
-  <channel>pear.php.net</channel>
-  <min>1.4.0</min>
-  <max>1.4.0</max>
- </compatible>
- <dependencies>
-  <required>
-   <php>
-    <min>4.3</min>
-   </php>
-   <pearinstaller>
-    <min>1.4.0b1</min>
-   </pearinstaller>
-   <package>
-    <name>PEAR</name>
-    <channel>pear.php.net</channel>
-   </package>
-   <package>
-    <name>HTTP_Request</name>
-    <channel>pear.php.net</channel>
-   </package>
-  </required>
-  <optional>
-   <package>
-    <name>Mail</name>
-    <channel>pear.php.net</channel>
-   </package>
-   <package>
-    <name>Mail_Mime</name>
-    <channel>pear.php.net</channel>
-   </package>
-   <package>
-    <name>Net_DIME</name>
-    <channel>pear.php.net</channel>
-   </package>
-  </optional>
- </dependencies>
- <phprelease />
-</package>
