• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
I think she's lovely. It's this tiny ad that called her crazy:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic