From c619ade9b79afdbc176bba6180a37970cd4343e2 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 31 Mar 2007 07:01:18 +0000 Subject: added primitive array soap types. http://www.pradosoft.com/forum/index.php/topic,7095.0/topicseen.html --- framework/3rdParty/WsdlGen/Wsdl.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'framework/3rdParty/WsdlGen/Wsdl.php') diff --git a/framework/3rdParty/WsdlGen/Wsdl.php b/framework/3rdParty/WsdlGen/Wsdl.php index eaf95ef1..4de57e6b 100644 --- a/framework/3rdParty/WsdlGen/Wsdl.php +++ b/framework/3rdParty/WsdlGen/Wsdl.php @@ -78,6 +78,8 @@ class Wsdl private $_encoding=''; + private static $_primitiveTypes = array('string', 'int', 'float', 'boolean'); + /** * Creates a new Wsdl thing * @param string $name the name of the service. @@ -151,7 +153,7 @@ class Wsdl $restriction->setAttribute('base', 'soap-enc:Array'); $attribute = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:attribute'); $attribute->setAttribute('ref', "soap-enc:arrayType"); - $attribute->setAttribute('wsdl:arrayType', 'tns:' . substr($type, 0, strlen($type) - 5) . '[]'); + $attribute->setAttribute('wsdl:arrayType', $this->getArrayTypePrefix($type) . substr($type, 0, strlen($type) - 5) . '[]'); $restriction->appendChild($attribute); $complexContent->appendChild($restriction); $complexType->appendChild($complexContent); @@ -175,6 +177,15 @@ class Wsdl $this->definitions->appendChild($types); } + /** + * @return string prefix 'xsd:' for primitive array types, otherwise, 'tns:' + */ + protected function getArrayTypePrefix($type) + { + $elementType = substr($type, 0, strlen($type) - 5); + return in_array($elementType, self::$_primitiveTypes) ? 'xsd:' : 'tns:'; + } + /** * Add messages for the service * @param DomDocument $dom The document to add to -- cgit v1.2.3