My favorites | Sign in
Logo
             
New issue | Search
for
| Advanced search | Search tips
Issue 192: soap-enc:Array not a valid complex type(?)
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----
Type-Defect
Priority-Medium
Milestone-3.1.7


Sign in to add a comment
 
Reported by moso...@esix.hu, Aug 05, 2009
Many wsdl parser cannot parse well the prado generated wsdl-s when using an
objectarray as parameter. For example soapui cannot generate the empty
objects. With my modification it seems to be solved. 

Tag: prado-3.1.6.r2699

1. example source:
    /**
     * @param ProductObject[] $ProductsArray
     * @return addOrUpdateProductResults
     * @soapmethod
     */
    public function addOrUpdateProduct($ProductsArray) {
...

Old one:
            <xsd:complexType name="ProductObjectArray">
                <xsd:complexContent>
                    <xsd:restriction base="soap-enc:Array">
                        <xsd:attribute ref="soap-enc:arrayType"
wsdl:arrayType="tns:ProductObject[]"/>
                    </xsd:restriction>
                </xsd:complexContent>
            </xsd:complexType>

With the new one:
            <xsd:complexType name="ProductObjectArray">
                <xsd:sequence>
                    <xsd:element
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ProductObject"
type="tns:ProductObject" minOccurs="0" maxOccurs="unbounded"/>
                </xsd:sequence>
            </xsd:complexType>

DIFF:

Index: 3rdParty/WsdlGen/Wsdl.php
===================================================================
--- 3rdParty/WsdlGen/Wsdl.php	(revision 57)
+++ 3rdParty/WsdlGen/Wsdl.php	(working copy)
@@ -148,15 +148,16 @@
 			$complexType->setAttribute('name', $type);
 			if(substr($type, strlen($type) - 5, 5) == 'Array')  // if it's an array
 			{
-				$complexContent =
$dom->createElementNS('http://www.w3.org/2001/XMLSchema',
'xsd:complexContent');
-				$restriction =
$dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:restriction');
-				$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',
$this->getArrayTypePrefix($type) . substr($type, 0, strlen($type) - 5) . '[]');
-				$restriction->appendChild($attribute);
-				$complexContent->appendChild($restriction);
-				$complexType->appendChild($complexContent);
+                               $sequence =
$dom->createElement("xsd:sequence");
+
+                               $singularType = substr($type, 0,
strlen($type) - 5);
+                               $xsdRestriction =
$dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:element');
+                               $xsdRestriction->setAttribute('name',
$singularType);
+                               $xsdRestriction->setAttribute('type',
sprintf('tns:%s',$singularType));
+                               $xsdRestriction->setAttribute('minOccurs','0');
+                              
$xsdRestriction->setAttribute('maxOccurs','unbounded');
+                               $sequence->appendChild($xsdRestriction);
+                               $complexType->appendChild($sequence);
 			}
 			else
 			{


Sign in to add a comment

Hosted by Google Code