WSDL simpleTypes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




I noticed that PEAR::SOAP's WSDL parsing doesn't support simpleTypes, which we use for enumeration types. I added some simpleType enumeration processing into WSDL.php. It only handles enumerations properly, so it's incomplete, but I thought I would post the changes to help out anyone who uses enumerations.


-Chris

*** original/WSDL.php Tue Oct 7 14:56:19 2003
--- WSDL.php Wed Oct 15 13:45:16 2003
***************
*** 52,57 ****
--- 52,58 ----
var $ns = array();
var $xsd = SOAP_XML_SCHEMA_VERSION;
var $complexTypes = array();
+ var $simpleTypes = array();
var $elements = array();
var $messages = array();
var $portTypes = array();
***************
*** 909,914 ****
--- 910,916 ----
var $schemaStatus = '';
var $schema_stack = array();
var $currentComplexType;
+ var $currentSimpleType;
var $schema_element_stack = array();
var $currentElement;
***************
*** 988,996 ****
--- 990,1010 ----
$this->schema = $this->wsdl->getNamespaceAttributeName($this->wsdl->tns);
}
$this->wsdl->complexTypes[$this->schema] = array();
+ $this->wsdl->simpleTypes[$this->schema] = array();
$this->wsdl->elements[$this->schema] = array();
}
break;
+ case 'simpleType':
+ if ($parent_tag == 'schema') {
+ $this->currentSimpleType = $attrs['name'];
+ if (!isset($attrs['namespace'])) $attrs['namespace'] = $this->schema;
+ $this->wsdl->simpleTypes[$this->schema][$this->currentSimpleType] = $attrs;
+ $this->wsdl->simpleTypes[$this->schema][$this->currentSimpleType]['type'] = 'Enumeration';
+ $this->schemaStatus = 'simpleType';
+ } else {
+ $this->wsdl->elements[$this->schema][$this->currentElement]['simple'] = TRUE;
+ }
+ break;
case 'complexType':
if ($parent_tag == 'schema') {
$this->currentComplexType = $attrs['name'];
***************
*** 1048,1065 ****
$this->wsdl->elements[$this->schema][$parentElement]['elements'][$this->currentElement] = $attrs;
}
break;
case 'complexContent':
- case 'simpleContent':
break;
case 'extension':
case 'restriction':
! if ($this->schemaStatus == 'complexType') {
if ($attrs['base']) {
$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;
} else {
! $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Struct';
}
}
break;
--- 1062,1089 ----
$this->wsdl->elements[$this->schema][$parentElement]['elements'][$this->currentElement] = $attrs;
}
break;
+ case 'enumeration':
+ if ($this->schemaStatus=='simpleType') {
+ if (!is_array($this->wsdl->simpleTypes[$this->schema][$this->currentSimpleType]['values']))
+ $this->wsdl->simpleTypes[$this->schema][$this->currentSimpleType]['values'] = array();
+ + $this->wsdl->simpleTypes[$this->schema][$this->currentSimpleType]['values'][] = $attrs['value'];
+ }
+ break;
case 'complexContent':
break;
case 'extension':
case 'restriction':
! if ($this->schemaStatus == 'complexType' || $this->schemaStatus == 'simpleType') {
! $topvar = $this->schemaStatus . "s";
! $currentvar = "current" . ucfirst($this->schemaStatus);
! if ($attrs['base']) {
$qn =& new QName($attrs['base']);
! $this->wsdl->{$topvar}[$this->schema][$this->$currentvar]['type'] = $qn->name;
! $this->wsdl->{$topvar}[$this->schema][$this->$currentvar]['namespace'] = $qn->ns;
} else {
! $this->wsdl->{$topvar}[$this->schema][$this->$currentvar]['type'] = 'Struct';
}
}
break;
***************
*** 1478,1483 ****
--- 1502,1513 ----
if (count($this->schema_element_stack) > 0)
$this->currentElement = array_pop($this->schema_element_stack);
else
+ $this->currentElement = '';
+ } else if (stristr($name,'simpleType')) {
+ $this->currentSimpleType = '';
+ if (count($this->schema_element_stack) > 0)
+ $this->currentElement = array_pop($this->schema_element_stack);
+ else
$this->currentElement = '';
} else if (stristr($name,'element')) {
if (count($this->schema_element_stack) > 0)


--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux