cvs: pear /SOAP WSDL.php
| From: | Shane Caraveo | Date: | Tue, 21 May 2002 07:22:09 +0000 |
| Subject: | cvs: pear /SOAP WSDL.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-4005@lists.php.net to get a copy of this message | ||
shane Tue May 21 03:22:09 2002 EDT
Modified files:
/pear/SOAP WSDL.php
Log:
a couple wsdl fixes, now parses a bit more without warnings and such
Index: pear/SOAP/WSDL.php
diff -u pear/SOAP/WSDL.php:1.21 pear/SOAP/WSDL.php:1.22
--- pear/SOAP/WSDL.php:1.21 Mon May 13 13:32:45 2002
+++ pear/SOAP/WSDL.php Tue May 21 03:22:09 2002
@@ -17,7 +17,7 @@
// | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author |
// +----------------------------------------------------------------------+
//
-// $Id: WSDL.php,v 1.21 2002/05/13 17:32:45 shane Exp $
+// $Id: WSDL.php,v 1.22 2002/05/21 07:22:09 shane Exp $
//
require_once 'SOAP/Base.php';
require_once 'SOAP/Fault.php';
@@ -34,10 +34,11 @@
*
* TODO:
* add wsdl caching
+* refactor namespace handling ($namespace/$ns)
* implement IDL type syntax declaration so we can generate WSDL
*
* @access public
-* @version $Id: WSDL.php,v 1.21 2002/05/13 17:32:45 shane Exp $
+* @version $Id: WSDL.php,v 1.22 2002/05/21 07:22:09 shane Exp $
* @package SOAP::Client
* @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates
* @author Dietrich Ayala <dietrich@ganx4.com> Original Author
@@ -89,9 +90,11 @@
// find the name of the first port that contains an operation of name $operation
function getPortName($operation)
{
- foreach ($this->services[$this->service]['ports'] as $port =>
$portAttrs) {
- if
($this->bindings[$portAttrs['binding']]['operations'][$operation] !=
'') {
- return $port;
+ if (isset($this->services[$this->service]['ports'])) {
+ foreach ($this->services[$this->service]['ports'] as $port =>
$portAttrs) {
+ if
($this->bindings[$portAttrs['binding']]['operations'][$operation] !=
'') {
+ return $port;
+ }
}
}
return $this->raiseSoapFault("no operation $operation in wsdl",
$this->uri);
@@ -170,9 +173,9 @@
if (array_key_exists($namespace, $this->ns)) {
return $this->ns[$namespace];
}
- $this->nsc++;
- $attr = 'ns'.$this->nsc;
- $this->namespaces['ns'.$this->nsc] = $namespace;
+ $n = count($this->ns);
+ $attr = 'ns'.$n;
+ $this->namespaces['ns'.$n] = $namespace;
$this->ns[$namespace] = $attr;
return $attr;
}
@@ -507,7 +510,11 @@
break;
default:
if ($this->currentOperation) {
-
$this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name] =
array_merge($this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name],$attrs);
+ if
(isset($this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]))
{
+
$this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name] =
array_merge($this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name],$attrs);
+ } else {
+
$this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name] = $attrs;
+ }
if (array_key_exists('message',$attrs)) {
$qn = new QName($attrs['message']);
$this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['message']
= $qn->name;
@@ -607,7 +614,9 @@
foreach ($attrs as $key => $value) {
if (strstr($key,'xmlns:') !== FALSE) {
$qn = new QName($key);
+ // XXX need to refactor ns handling
$this->wsdl->namespaces[$qn->name] = $value;
+ $this->wsdl->ns[$value] = $qn->name;
if ($key == 'targetNamespace' ||
strcasecmp($value,SOAP_SCHEMA)==0) {
$this->soapns[] = strtolower($qn->name);
@@ -638,7 +647,8 @@
array_pop($this->schema_stack);
if (count($this->schema_stack) <= 1) {
/* correct the type for sequences with multiple elements */
- if
($this->wsdl->complexTypes[$this->schema][$this->currentElement]['type'] ==
'Array'
+ if
(isset($this->wsdl->complexTypes[$this->schema][$this->currentElement]['type'])
+ &&
$this->wsdl->complexTypes[$this->schema][$this->currentElement]['type'] ==
'Array'
&&
array_key_exists('elements',$this->wsdl->complexTypes[$this->schema][$this->currentElement])
&&
count($this->wsdl->complexTypes[$this->schema][$this->currentElement]['elements'])
> 1) {
$this->wsdl->complexTypes[$this->schema][$this->currentElement]['type'] =
'Struct';