cvs: pear /SOAP Base.php Client.php Server.php WSDL.php /SOAP/tools genproxy.php
| From: | Shane Caraveo | Date: | Tue, 01 Oct 2002 23:45:41 +0000 |
| Subject: | cvs: pear /SOAP Base.php Client.php Server.php WSDL.php /SOAP/tools genproxy.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-6808@lists.php.net to get a copy of this message | ||
shane Tue Oct 1 19:45:41 2002 EDT
Modified files:
/pear/SOAP Base.php Client.php Server.php WSDL.php
/pear/SOAP/tools genproxy.php
Log:
a few bug fixes
fix method namespace when dealing with some doc/lit stuff
allow additional classname prefix to be added in wsdl proxy generation
Index: pear/SOAP/Base.php diff -u pear/SOAP/Base.php:1.23 pear/SOAP/Base.php:1.24 --- pear/SOAP/Base.php:1.23 Sat Sep 28 21:06:07 2002 +++ pear/SOAP/Base.php Tue Oct 1 19:45:41 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Base.php,v 1.23 2002/09/29 01:06:07 shane Exp $ +// $Id: Base.php,v 1.24 2002/10/01 23:45:41 shane Exp $ // /* @@ -79,7 +79,8 @@ define('INF', 1.8e307); define('NAN', 0.0); -define('SOAP_LIBRARY_NAME', 'PEAR-SOAP 0.6.2'); +define('SOAP_LIBRARY_VERSION', '0.6.3'); +define('SOAP_LIBRARY_NAME', 'PEAR-SOAP 0.6.3'); // set schema version define('SOAP_XML_SCHEMA_VERSION', 'http://www.w3.org/2001/XMLSchema'); define('SOAP_XML_SCHEMA_INSTANCE', 'http://www.w3.org/2001/XMLSchema-instance'); @@ -112,7 +113,7 @@ * Common base class of all Soap lclasses * * @access public -* @version $Id: Base.php,v 1.23 2002/09/29 01:06:07 shane Exp $ +* @version $Id: Base.php,v 1.24 2002/10/01 23:45:41 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates */ @@ -406,10 +407,10 @@ // XXX get the members and serialize them instead // converting to an array is more overhead than we // should realy do, but php-soap is on it's way. - $xmlout_value .= $this->_serializeValue(get_object_vars($vars[$k]), $k); + $xmlout_value .= $this->_serializeValue(get_object_vars($vars[$k]), $k, false, $this->_section5?NULL:$elNamespace); } } else { - $xmlout_value .= $this->_serializeValue($vars[$k],$k); + $xmlout_value .= $this->_serializeValue($vars[$k],$k, false, $this->_section5?NULL:$elNamespace); } } } @@ -444,7 +445,7 @@ } else { $array_type = $this->_getType($array_val); $array_types[$array_type] = 1; - $xmlout_value .= $this->_serializeValue($array_val,'item', $array_type); + $xmlout_value .= $this->_serializeValue($array_val,'item', $array_type, $this->_section5?NULL:$elNamespace); } } @@ -486,13 +487,8 @@ // add namespaces if ($elNamespace) { - if ($this->_section5) { - $elPrefix = $this->_getNamespacePrefix($elNamespace); - $xmlout_name = "$elPrefix:$name"; - } else { - $xmlns = " xmlns:ns1=\"$elNamespace\""; - $xmlout_name = 'ns1:'.$name; - } + $elPrefix = $this->_getNamespacePrefix($elNamespace); + $xmlout_name = "$elPrefix:$name"; } else { $xmlout_name = $name; } @@ -966,7 +962,7 @@ * class used to handle QNAME values in XML * * @access public -* @version $Id: Base.php,v 1.23 2002/09/29 01:06:07 shane Exp $ +* @version $Id: Base.php,v 1.24 2002/10/01 23:45:41 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates */ Index: pear/SOAP/Client.php diff -u pear/SOAP/Client.php:1.41 pear/SOAP/Client.php:1.42 --- pear/SOAP/Client.php:1.41 Sat Sep 28 21:06:07 2002 +++ pear/SOAP/Client.php Tue Oct 1 19:45:41 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Client.php,v 1.41 2002/09/29 01:06:07 shane Exp $ +// $Id: Client.php,v 1.42 2002/10/01 23:45:41 shane Exp $ // require_once 'SOAP/Value.php'; @@ -37,7 +37,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Client.php,v 1.41 2002/09/29 01:06:07 shane Exp $ +* @version $Id: Client.php,v 1.42 2002/10/01 23:45:41 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Stig Bakken <ssb@fast.no> Conversion to PEAR @@ -297,6 +297,7 @@ $this->fault = null; $this->__options['input']='parse'; $this->__options['result']='parse'; + $this->__options['parameters'] = false; if ($params && gettype($params) != 'array') { $params = array($params); } @@ -319,7 +320,6 @@ if (PEAR::isError($this->_portName)) { return $this->_raiseSoapFault($this->_portName); } - $namespace = $this->_wsdl->getNamespace($this->_portName, $method); // get endpoint $this->_endpoint = $this->_wsdl->getEndpoint($this->_portName); @@ -333,12 +333,14 @@ if (PEAR::isError($opData)) { return $this->_raiseSoapFault($opData); } + $namespace = $opData['namespace']; $this->__options['style'] = $opData['style']; $this->__options['use'] = $opData['input']['use']; $this->__options['soapaction'] = $opData['soapAction']; // set input params if ($this->__options['input'] == 'parse') { + $this->__options['parameters'] = $opData['parameters']; $nparams = array(); if (isset($opData['input']['parts']) && count($opData['input']['parts']) > 0) { $i = 0; @@ -389,8 +391,8 @@ } // serialize the message - $this->section5 = TRUE; // assume we encode with section 5 - if (isset($this->__options['use']) && $this->__options['use']=='literal') $this->section5 = FALSE; + $this->_section5 = TRUE; // assume we encode with section 5 + if (isset($this->__options['use']) && $this->__options['use']=='literal') $this->_section5 = FALSE; if (!isset($this->__options['style']) || $this->__options['style'] == 'rpc') { $this->__options['style'] = 'rpc'; @@ -413,6 +415,10 @@ } } $params = $nparams; + } + if ($this->__options['parameters']) { + $mqname = new QName($method, $namespace); + $params = new SOAP_Value($mqname->fqn(), 'Struct', $params); } } $soap_msg = $this->_makeEnvelope($params, $this->headersOut, $this->_encoding,$this->__options); Index: pear/SOAP/Server.php diff -u pear/SOAP/Server.php:1.25 pear/SOAP/Server.php:1.26 --- pear/SOAP/Server.php:1.25 Sat Sep 28 21:06:08 2002 +++ pear/SOAP/Server.php Tue Oct 1 19:45:41 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Server.php,v 1.25 2002/09/29 01:06:08 shane Exp $ +// $Id: Server.php,v 1.26 2002/10/01 23:45:41 shane Exp $ // require_once 'SOAP/Base.php'; @@ -40,7 +40,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Server.php,v 1.25 2002/09/29 01:06:08 shane Exp $ +* @version $Id: Server.php,v 1.26 2002/10/01 23:45:41 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -299,7 +299,7 @@ if ($isok) { # call our header now! $header_method = $header_val->name; - $header_data = array($this->decode($header_val)); + $header_data = array($this->_decode($header_val)); // if there are parameters to pass $hr = $this->callMethod($header_method, $header_data); # if they return a fault, then it's all over! @@ -322,7 +322,7 @@ $this->method_namespace = $parser->message[$parser->root_struct[0]]['namespace']; // does method exist? if (!$this->methodname || !$this->validateMethod($this->methodname,$this->method_namespace)) { - $this->_raiseSoapFault("method '{$this->method_namespace}$this->methodname' not defined in service",'','','Server'); + $this->_raiseSoapFault("method '\{$this->method_namespace\}$this->methodname' not defined in service",'','','Server'); return NULL; } @@ -437,7 +437,6 @@ function validateMethod($methodname, $namespace = NULL) { unset($this->soapobject); - $this->method_namespace = NULL; # no soap access to private functions if ($methodname[0] == '_') return FALSE; Index: pear/SOAP/WSDL.php diff -u pear/SOAP/WSDL.php:1.27 pear/SOAP/WSDL.php:1.28 --- pear/SOAP/WSDL.php:1.27 Sat Sep 28 21:06:08 2002 +++ pear/SOAP/WSDL.php Tue Oct 1 19:45:41 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: WSDL.php,v 1.27 2002/09/29 01:06:08 shane Exp $ +// $Id: WSDL.php,v 1.28 2002/10/01 23:45:41 shane Exp $ // require_once 'SOAP/Base.php'; require_once 'SOAP/Fault.php'; @@ -39,7 +39,7 @@ * implement IDL type syntax declaration so we can generate WSDL * * @access public -* @version $Id: WSDL.php,v 1.27 2002/09/29 01:06:08 shane Exp $ +* @version $Id: WSDL.php,v 1.28 2002/10/01 23:45:41 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -61,7 +61,7 @@ var $service = ''; var $uri = ''; var $proxy = NULL; - + var $trace = 0; /** * SOAP_WSDL constructor * @@ -135,12 +135,15 @@ } if (!$opData) return $this->_raiseSoapFault("no operation $operation for port $portName, in wsdl", $this->uri); + $opData['parameters'] = false; + $opData['namespace'] = $this->bindings[$this->services[$this->service]['ports'][$portName]['binding']]['operations'][$operation]['input']['namespace']; // message data from messages $inputMsg = $opData['input']['message']; foreach ($this->messages[$inputMsg] as $pname => $pattrs) { if ($opData['style'] == 'document' && $opData['input']['use'] == 'literal' && $pname == 'parameters') { - + $opData['parameters'] = true; + $opData['namespace'] = $this->namespaces[$pattrs['namespace']]; $el = $this->elements[$pattrs['namespace']][$pattrs['type']]; if ($el['elements']) { foreach ($el['elements'] as $elname => $elattrs) { @@ -295,7 +298,7 @@ * generateProxyCode * generates stub code from the wsdl that can be saved to a file, or eval'd into existence */ - function generateProxyCode($port = '') + function generateProxyCode($port = '', $classname='') { $multiport = count($this->services[$this->service]['ports']) > 1; if (!$port) { @@ -304,12 +307,14 @@ } // XXX currentPort is BAD $clienturl = $port['address']['location']; - if ($multiport || $port) { - $classname = 'WebService_'.$this->service.'_'.$port['name']; - } else { - $classname = 'WebService_'.$this->service; + if (!$classname) { + if ($multiport || $port) { + $classname = 'WebService_'.$this->service.'_'.$port['name']; + } else { + $classname = 'WebService_'.$this->service; + } + $classname = str_replace('.','_',$classname); } - $classname = str_replace('.','_',$classname); if (!$this->_validateString($classname)) return NULL; @@ -403,7 +408,8 @@ " array('namespace'=>'$namespace',\n". " 'soapaction'=>'$soapaction',\n". " 'style'=>'$opstyle',\n". - " 'use'=>'$use')); \n". + " 'use'=>'$use'". + ($this->trace?",'trace'=>1":"")." ));\n". " }\n"; } $class .= "}\n"; @@ -420,7 +426,7 @@ return $proxycode; } - function getProxy($port = '') + function getProxy($port = '', $name='') { $multiport = count($this->services[$this->service]['ports']) > 1; if (!$port) { @@ -432,9 +438,10 @@ } else { $classname = 'WebService_'.$this->service; } - $classname = str_replace('.','_',$classname); + if ($name) $classname = $name.'_'.$classname; + $classname = preg_replace('/[ .\(\)]+/','_',$classname); if (!class_exists($classname)) { - $proxy = $this->generateProxyCode($port); + $proxy = $this->generateProxyCode($port,$classname); eval($proxy); } return new $classname; @@ -1103,7 +1110,7 @@ $this->currentImport = $attrs['namespace']; $this->wsdl->imports[$this->currentImport] = $attrs; } - $this->status = 'import'; + $this->status = ''; case 'types': // sect 2.2 wsdl:types $this->status = 'types'; Index: pear/SOAP/tools/genproxy.php diff -u pear/SOAP/tools/genproxy.php:1.4 pear/SOAP/tools/genproxy.php:1.5 --- pear/SOAP/tools/genproxy.php:1.4 Sat Sep 28 21:06:11 2002 +++ pear/SOAP/tools/genproxy.php Tue Oct 1 19:45:41 2002 @@ -12,7 +12,7 @@ function do_wsdl($uri) { $wsdl = new SOAP_WSDL($uri); - #print $wsdl->generateAllProxies(); + print $wsdl->generateAllProxies(); } echo "<?php\n\nrequire_once 'SOAP/Client.php';\n\n"; do_wsdl($_SERVER['argv'][1]);
Index: pear/SOAP/Base.php diff -u pear/SOAP/Base.php:1.23 pear/SOAP/Base.php:1.24 --- pear/SOAP/Base.php:1.23 Sat Sep 28 21:06:07 2002 +++ pear/SOAP/Base.php Tue Oct 1 19:45:41 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Base.php,v 1.23 2002/09/29 01:06:07 shane Exp $ +// $Id: Base.php,v 1.24 2002/10/01 23:45:41 shane Exp $ // /* @@ -79,7 +79,8 @@ define('INF', 1.8e307); define('NAN', 0.0); -define('SOAP_LIBRARY_NAME', 'PEAR-SOAP 0.6.2'); +define('SOAP_LIBRARY_VERSION', '0.6.3'); +define('SOAP_LIBRARY_NAME', 'PEAR-SOAP 0.6.3'); // set schema version define('SOAP_XML_SCHEMA_VERSION', 'http://www.w3.org/2001/XMLSchema'); define('SOAP_XML_SCHEMA_INSTANCE', 'http://www.w3.org/2001/XMLSchema-instance'); @@ -112,7 +113,7 @@ * Common base class of all Soap lclasses * * @access public -* @version $Id: Base.php,v 1.23 2002/09/29 01:06:07 shane Exp $ +* @version $Id: Base.php,v 1.24 2002/10/01 23:45:41 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates */ @@ -406,10 +407,10 @@ // XXX get the members and serialize them instead // converting to an array is more overhead than we // should realy do, but php-soap is on it's way. - $xmlout_value .= $this->_serializeValue(get_object_vars($vars[$k]), $k); + $xmlout_value .= $this->_serializeValue(get_object_vars($vars[$k]), $k, false, $this->_section5?NULL:$elNamespace); } } else { - $xmlout_value .= $this->_serializeValue($vars[$k],$k); + $xmlout_value .= $this->_serializeValue($vars[$k],$k, false, $this->_section5?NULL:$elNamespace); } } } @@ -444,7 +445,7 @@ } else { $array_type = $this->_getType($array_val); $array_types[$array_type] = 1; - $xmlout_value .= $this->_serializeValue($array_val,'item', $array_type); + $xmlout_value .= $this->_serializeValue($array_val,'item', $array_type, $this->_section5?NULL:$elNamespace); } } @@ -486,13 +487,8 @@ // add namespaces if ($elNamespace) { - if ($this->_section5) { - $elPrefix = $this->_getNamespacePrefix($elNamespace); - $xmlout_name = "$elPrefix:$name"; - } else { - $xmlns = " xmlns:ns1=\"$elNamespace\""; - $xmlout_name = 'ns1:'.$name; - } + $elPrefix = $this->_getNamespacePrefix($elNamespace); + $xmlout_name = "$elPrefix:$name"; } else { $xmlout_name = $name; } @@ -966,7 +962,7 @@ * class used to handle QNAME values in XML * * @access public -* @version $Id: Base.php,v 1.23 2002/09/29 01:06:07 shane Exp $ +* @version $Id: Base.php,v 1.24 2002/10/01 23:45:41 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates */ Index: pear/SOAP/Client.php diff -u pear/SOAP/Client.php:1.41 pear/SOAP/Client.php:1.42 --- pear/SOAP/Client.php:1.41 Sat Sep 28 21:06:07 2002 +++ pear/SOAP/Client.php Tue Oct 1 19:45:41 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Client.php,v 1.41 2002/09/29 01:06:07 shane Exp $ +// $Id: Client.php,v 1.42 2002/10/01 23:45:41 shane Exp $ // require_once 'SOAP/Value.php'; @@ -37,7 +37,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Client.php,v 1.41 2002/09/29 01:06:07 shane Exp $ +* @version $Id: Client.php,v 1.42 2002/10/01 23:45:41 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Stig Bakken <ssb@fast.no> Conversion to PEAR @@ -297,6 +297,7 @@ $this->fault = null; $this->__options['input']='parse'; $this->__options['result']='parse'; + $this->__options['parameters'] = false; if ($params && gettype($params) != 'array') { $params = array($params); } @@ -319,7 +320,6 @@ if (PEAR::isError($this->_portName)) { return $this->_raiseSoapFault($this->_portName); } - $namespace = $this->_wsdl->getNamespace($this->_portName, $method); // get endpoint $this->_endpoint = $this->_wsdl->getEndpoint($this->_portName); @@ -333,12 +333,14 @@ if (PEAR::isError($opData)) { return $this->_raiseSoapFault($opData); } + $namespace = $opData['namespace']; $this->__options['style'] = $opData['style']; $this->__options['use'] = $opData['input']['use']; $this->__options['soapaction'] = $opData['soapAction']; // set input params if ($this->__options['input'] == 'parse') { + $this->__options['parameters'] = $opData['parameters']; $nparams = array(); if (isset($opData['input']['parts']) && count($opData['input']['parts']) > 0) { $i = 0; @@ -389,8 +391,8 @@ } // serialize the message - $this->section5 = TRUE; // assume we encode with section 5 - if (isset($this->__options['use']) && $this->__options['use']=='literal') $this->section5 = FALSE; + $this->_section5 = TRUE; // assume we encode with section 5 + if (isset($this->__options['use']) && $this->__options['use']=='literal') $this->_section5 = FALSE; if (!isset($this->__options['style']) || $this->__options['style'] == 'rpc') { $this->__options['style'] = 'rpc'; @@ -413,6 +415,10 @@ } } $params = $nparams; + } + if ($this->__options['parameters']) { + $mqname = new QName($method, $namespace); + $params = new SOAP_Value($mqname->fqn(), 'Struct', $params); } } $soap_msg = $this->_makeEnvelope($params, $this->headersOut, $this->_encoding,$this->__options); Index: pear/SOAP/Server.php diff -u pear/SOAP/Server.php:1.25 pear/SOAP/Server.php:1.26 --- pear/SOAP/Server.php:1.25 Sat Sep 28 21:06:08 2002 +++ pear/SOAP/Server.php Tue Oct 1 19:45:41 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Server.php,v 1.25 2002/09/29 01:06:08 shane Exp $ +// $Id: Server.php,v 1.26 2002/10/01 23:45:41 shane Exp $ // require_once 'SOAP/Base.php'; @@ -40,7 +40,7 @@ * originaly based on SOAPx4 by Dietrich Ayala http://dietrich.ganx4.com/soapx4 * * @access public -* @version $Id: Server.php,v 1.25 2002/09/29 01:06:08 shane Exp $ +* @version $Id: Server.php,v 1.26 2002/10/01 23:45:41 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -299,7 +299,7 @@ if ($isok) { # call our header now! $header_method = $header_val->name; - $header_data = array($this->decode($header_val)); + $header_data = array($this->_decode($header_val)); // if there are parameters to pass $hr = $this->callMethod($header_method, $header_data); # if they return a fault, then it's all over! @@ -322,7 +322,7 @@ $this->method_namespace = $parser->message[$parser->root_struct[0]]['namespace']; // does method exist? if (!$this->methodname || !$this->validateMethod($this->methodname,$this->method_namespace)) { - $this->_raiseSoapFault("method '{$this->method_namespace}$this->methodname' not defined in service",'','','Server'); + $this->_raiseSoapFault("method '\{$this->method_namespace\}$this->methodname' not defined in service",'','','Server'); return NULL; } @@ -437,7 +437,6 @@ function validateMethod($methodname, $namespace = NULL) { unset($this->soapobject); - $this->method_namespace = NULL; # no soap access to private functions if ($methodname[0] == '_') return FALSE; Index: pear/SOAP/WSDL.php diff -u pear/SOAP/WSDL.php:1.27 pear/SOAP/WSDL.php:1.28 --- pear/SOAP/WSDL.php:1.27 Sat Sep 28 21:06:08 2002 +++ pear/SOAP/WSDL.php Tue Oct 1 19:45:41 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: WSDL.php,v 1.27 2002/09/29 01:06:08 shane Exp $ +// $Id: WSDL.php,v 1.28 2002/10/01 23:45:41 shane Exp $ // require_once 'SOAP/Base.php'; require_once 'SOAP/Fault.php'; @@ -39,7 +39,7 @@ * implement IDL type syntax declaration so we can generate WSDL * * @access public -* @version $Id: WSDL.php,v 1.27 2002/09/29 01:06:08 shane Exp $ +* @version $Id: WSDL.php,v 1.28 2002/10/01 23:45:41 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates * @author Dietrich Ayala <dietrich@ganx4.com> Original Author @@ -61,7 +61,7 @@ var $service = ''; var $uri = ''; var $proxy = NULL; - + var $trace = 0; /** * SOAP_WSDL constructor * @@ -135,12 +135,15 @@ } if (!$opData) return $this->_raiseSoapFault("no operation $operation for port $portName, in wsdl", $this->uri); + $opData['parameters'] = false; + $opData['namespace'] = $this->bindings[$this->services[$this->service]['ports'][$portName]['binding']]['operations'][$operation]['input']['namespace']; // message data from messages $inputMsg = $opData['input']['message']; foreach ($this->messages[$inputMsg] as $pname => $pattrs) { if ($opData['style'] == 'document' && $opData['input']['use'] == 'literal' && $pname == 'parameters') { - + $opData['parameters'] = true; + $opData['namespace'] = $this->namespaces[$pattrs['namespace']]; $el = $this->elements[$pattrs['namespace']][$pattrs['type']]; if ($el['elements']) { foreach ($el['elements'] as $elname => $elattrs) { @@ -295,7 +298,7 @@ * generateProxyCode * generates stub code from the wsdl that can be saved to a file, or eval'd into existence */ - function generateProxyCode($port = '') + function generateProxyCode($port = '', $classname='') { $multiport = count($this->services[$this->service]['ports']) > 1; if (!$port) { @@ -304,12 +307,14 @@ } // XXX currentPort is BAD $clienturl = $port['address']['location']; - if ($multiport || $port) { - $classname = 'WebService_'.$this->service.'_'.$port['name']; - } else { - $classname = 'WebService_'.$this->service; + if (!$classname) { + if ($multiport || $port) { + $classname = 'WebService_'.$this->service.'_'.$port['name']; + } else { + $classname = 'WebService_'.$this->service; + } + $classname = str_replace('.','_',$classname); } - $classname = str_replace('.','_',$classname); if (!$this->_validateString($classname)) return NULL; @@ -403,7 +408,8 @@ " array('namespace'=>'$namespace',\n". " 'soapaction'=>'$soapaction',\n". " 'style'=>'$opstyle',\n". - " 'use'=>'$use')); \n". + " 'use'=>'$use'". + ($this->trace?",'trace'=>1":"")." ));\n". " }\n"; } $class .= "}\n"; @@ -420,7 +426,7 @@ return $proxycode; } - function getProxy($port = '') + function getProxy($port = '', $name='') { $multiport = count($this->services[$this->service]['ports']) > 1; if (!$port) { @@ -432,9 +438,10 @@ } else { $classname = 'WebService_'.$this->service; } - $classname = str_replace('.','_',$classname); + if ($name) $classname = $name.'_'.$classname; + $classname = preg_replace('/[ .\(\)]+/','_',$classname); if (!class_exists($classname)) { - $proxy = $this->generateProxyCode($port); + $proxy = $this->generateProxyCode($port,$classname); eval($proxy); } return new $classname; @@ -1103,7 +1110,7 @@ $this->currentImport = $attrs['namespace']; $this->wsdl->imports[$this->currentImport] = $attrs; } - $this->status = 'import'; + $this->status = ''; case 'types': // sect 2.2 wsdl:types $this->status = 'types'; Index: pear/SOAP/tools/genproxy.php diff -u pear/SOAP/tools/genproxy.php:1.4 pear/SOAP/tools/genproxy.php:1.5 --- pear/SOAP/tools/genproxy.php:1.4 Sat Sep 28 21:06:11 2002 +++ pear/SOAP/tools/genproxy.php Tue Oct 1 19:45:41 2002 @@ -12,7 +12,7 @@ function do_wsdl($uri) { $wsdl = new SOAP_WSDL($uri); - #print $wsdl->generateAllProxies(); + print $wsdl->generateAllProxies(); } echo "<?php\n\nrequire_once 'SOAP/Client.php';\n\n"; do_wsdl($_SERVER['argv'][1]);