• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java code generated from WSDL using Jax WS not mapping array / list correctly?

 
Meca Erikson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I managed to generate java code from WSDL using Jax WS. However, the code is not working as expected.

I testing the WSDL using SoapUI which is able to return the result correctly.

Comparing both the xml (java code and SoupUI), I found that the xml tag is not coming correctly for java code.

********** Using SoupUI ***************
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sun="XXX/" xmlns:sun1="XXX.Contracts/">
<soapenv:Header/>
<soapenv:Body>
<sun:SearchXXX>
<!--Optional:-->
<sun:Identifier>?</sun:Identifier>
<!--Optional:-->
<sun:XXXSearchField>?</sun:XXXSearchField>
<!--Optional:-->
<sun:query>?</sun:query>
<!--Optional:-->
<sun:searchType>?</sun:searchType>
<!--Optional:-->
<sun:responseParameters>
<!--Optional:-->
<sun1:RelatedXXX>
<!--Zero or more repetitions:-->
<sun1:RelatedXXX>?</sun1:RelatedXXX>
</sun1:RelatedXXX>
</sun:responseParameters>
</sun:SearchXXX>
</soapenv:Body>
</soapenv:Envelope>
********** Using SoupUI ***************


********** from Java code ***************
<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<SearchXXX xmlns="...">
<Identifier>???</Identifier>
<XXXSearchField>???</XXXSearchField>
<query>???</query>
<searchType>???</searchType>
<responseParameters>
<ns2:ArrayOfRelatedXXX>
<ns2:RelatedXXX>???</ns2:RelatedXXX>
<ns2:RelatedXXX>???</ns2:RelatedXXX>
</ns2:ArrayOfRelatedXXX>
</responseParameters>
</SearchXXX>
</S:Body>
</S:Envelope>
********** from Java code ***************

As could be seen from above, under responseParameters tag the java code is creating "ArrayOfRelatedXXX" tag (not RelatedXXX). This caused the call to be failing.

Is there any way to generate java code correctly for such case? I attached the wsdl portion as below. It seems to be using complexType name "ArrayOfRelatedXXX" instead of the element name.

********** WSDL ************

<xs:complexType name="ResponseParameters">
<xs:sequence>
<xs:element minOccurs="0" name="RelatedXXX" nillable="true" type="tns:ArrayOfRelatedXXX"/>
</xs:sequence>
</xs:complexType>
<xs:element name="ResponseParameters" nillable="true" type="tns:ResponseParameters"/>
<xs:element name="RelatedXXX" nillable="true" type="tns:ArrayOfRelatedXXX"/>
<xs:complexType name="ArrayOfRelatedXXX">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="RelatedXXX" type="tns:RelatedXXX"/>
</xs:sequence>
</xs:complexType>

********** WSDL ************

Please help.
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect about the namespace it used in the WSDL file. The type <xs:element minOccurs="0" maxOccurs="unbounded" name="RelatedXXX" type="tns:RelatedXXX"/> is used a namespace of RelatedXXX that in turn inherits hierarchy from <xs:element name="RelatedXXX" nillable="true" type="tns:ArrayOfRelatedXXX"/> ArrayOfRelatedXXX. Can you just check with this?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!