Showing posts with label WSDL. Show all posts
Showing posts with label WSDL. Show all posts

Monday, April 26, 2010

Quick Fix for wsdls generated by Axis2 to run on IBM JDK

Some of you may have come across the problem. WSDLs generated from Axis2 has a problem of malfunctioning with the IBM JDK. (I'm not sure whether this occurs with other JDKs or other environments).

There's a quick fix that can be done so that these WSDLs function without a glitch on any JDK.

If a <xs:complex> tag has a name attribute, then replace the <xs:sequence> tag it has it's immediate child by <xs:all>.

ex:

Before fix:
<xs:complexType name="ServiceBean">
<xs:sequence>
<xs:element minOccurs="0" name="id" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
<xs:element maxOccurs="unbounded" minOccurs="0" name="policyBeans" nillable="true" type="ax2100:PolicyBean" />
<xs:element minOccurs="0" name="qName" nillable="true" type="xs:string" />
<xs:element maxOccurs="unbounded" minOccurs="0" name="schemaBeans" nillable="true" type="ax2100:SchemaBean" />
<xs:element maxOccurs="unbounded" minOccurs="0" name="wsdlBeans" nillable="true" type="ax2100:WSDLBean" />
</xs:sequence>
</xs:complexType>

After fix:
<xs:complexType name="ServiceBean">
<xs:all>
<xs:element minOccurs="0" name="id" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="path" nillable="true" type="xs:string" />
<xs:element maxOccurs="unbounded" minOccurs="0" name="policyBeans" nillable="true" type="ax2100:PolicyBean" />
<xs:element minOccurs="0" name="qName" nillable="true" type="xs:string" />
<xs:element maxOccurs="unbounded" minOccurs="0" name="schemaBeans" nillable="true" type="ax2100:SchemaBean" />
<xs:element maxOccurs="unbounded" minOccurs="0" name="wsdlBeans" nillable="true" type="ax2100:WSDLBean" />
</xs:all>
</xs:complexType>


Now you're wsdl should work on any jdk/server without a problem. Do leave a comment if this works. :)