ZF-6077: Zend Soap Wsdl Strategy ArrayOfComplexType fails to generate JAX importable descriptions
Description
Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex makes use of soap enc array currently unsupported by many if not all JAX tools. I currently solved this by modifying Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex; instead I use a sequence of objects, so I changed from:
$complexType = $dom->createElement('xsd:complexType');
$complexType->setAttribute('name', $xsdComplexTypeName);
$complexContent = $dom->createElement("xsd:complexContent");
$complexType->appendChild($complexContent);
$xsdRestriction = $dom->createElement("xsd:restriction");
$xsdRestriction->setAttribute('base', 'soap-enc:Array');
$complexContent->appendChild($xsdRestriction);
$xsdAttribute = $dom->createElement("xsd:attribute");
$xsdAttribute->setAttribute("ref", "soap-enc:arrayType");
$xsdAttribute->setAttribute("wsdl:arrayType", sprintf("tns:%s[]", $singularType));
$xsdRestriction->appendChild($xsdAttribute);
$this->getContext()->getSchema()->appendChild($complexType);
$this->getContext()->addType($xsdComplexTypeName);
to
$complexType = $dom->createElement('xsd:complexType');
$complexType->setAttribute('name', sprintf('%s',$xsdComplexTypeName));
$complexContent = $dom->createElement("xsd:sequence");
$complexType->appendChild($complexContent);
$xsdRestriction = $dom->createElement("xsd:element");
$xsdRestriction->setAttribute('name', $singularType);
$xsdRestriction->setAttribute('type', sprintf('tns:%s',$singularType));
$xsdRestriction->setAttribute('minOccurs','0');
$xsdRestriction->setAttribute('maxOccurs','unbounded');
$complexContent->appendChild($xsdRestriction);
$this->getContext()->getSchema()->appendChild($complexType);
$this->getContext()->addType($xsdComplexTypeName);
So the generated wsdl changes from:
to:
Works for me and can be imported using JAX wsimport
Comments
Posted by Jan Pieper (jpieper) on 2009-04-15T07:45:53.000+0000
Two weeks ago Benjamin and I talked about exactly this way how to solve the problem with other clients than php's SoapClient. I'll take a look at it to check if my problems will be solved by changing the code like mentioned.
Posted by Jan Pieper (jpieper) on 2009-04-15T14:00:15.000+0000
@Erick: seems to work fine. i've sent Benjamin my test environment in hope he can test it :-) didn't you need to add the "namespace"-attribute to ? my wsimport cannot create java sources/binaries without having this attribute.
@Benjamin: do we now need junit tests? we should check if we need the "namespace"-attribute for all elements.
Posted by Jan Pieper (jpieper) on 2009-04-16T13:12:42.000+0000
h2. Stable (using Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex)
h3. Java [automated class generation]
h3. Python (ZSI)
h2. Unstable (using Zoap_Wsdl_Strategy_ArrayOfTypeComplex)
h3. Java [automated class generation]
h3. Java [call all methods]
h3. Python (ZSI)
h2. Resources
http://zend.flabben.net/service.php?stable http://zend.flabben.net/service.php?unstable http://zend.flabben.net/sources/service.phps http://zend.flabben.net/sources/Zoap_Service.phps http://zend.flabben.net/sources/… http://zend.flabben.net/sources/…
Posted by Erick Martinez (emartinez) on 2009-04-25T11:24:37.000+0000
Jan: I'm not sure but I think I grabbed a version of Zend_Soap_Autodiscover from SVN trunk that can set namespace as you say. I'll check this later. About the wsimport you posted, which version of Zoap_Wsdl_Strategy_ArrayOfTypeComplex are you using? did you add namespace attribute?
Posted by Benjamin Eberlei (beberlei) on 2009-05-30T15:47:20.000+0000
Is the problem that Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence does not support complex types?
I guess the whole fun of strategies was to fix these problems to their specific kinds.
Does this issue go if ArrayOfTypeSequence supports complex types as suggested in ZF-6742? Would this patch fix your problem?
Posted by mark reverman (mreverman) on 2010-04-16T20:24:37.000+0000
I am trying to implement this fix it is needed for our workflow engine to work since it uses JAX. I have made the code change from above and still no luck. I am running latest version of ZF.