• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Automatically gen. code from WSDL results in XML with same tag for array and array elements

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I had to generate webservices from WSDL and I used Eclipse to do so (New -> Webservices -> Top-bottom, etc)
So far the generated code is good except for one thing: the arrays are not working as expected because the array tag is the same as the one given for the elements in the array.

This example will show you clearly what's going on:

A part of my WSDL where I have an array called "Transmisiones" whose elements should be tagged as "TransmisionDatos":



What I expected it to generate (an array Transmisiones with N embedded TransmisionDatos elements):


What it actually generates (response received using SoapUI for testing):


As you can see, surprisingly the tag for the array Transmisiones is the same as for the elements of the array.

I've been playing with the WSDL for days but I couldn't get the tool to generate code that uses a different tag for the array and its elements.

This code is useless because the program that is calling my WS expects a response with correctly build arrays.

Do I have to change the WSDL or any other thing? I'm going crazy over this, any help will be greatly appreciated . Cheers.
 
Igc Sa
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe I didn't make it clear enough.

I just want to know how to set up an array in WSDL so that the code generated by WSDL2Java names the array container (ListOfThings) different than the elements it contains (Thing)



Arrays in Webservices, it can't be so complicated, somebody must have hit this issue before.

Please help.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Have you tried wsimport in the JavaSE 6 JDK?
wsimport is similar to WSDL2Java. It is the standard web-service-artifact-producing-comman from Sun/Oracle.
Best wishes!
 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Basically, I used Eclipse to create a xml schema file NewXMLSchema.xsd
2. I generate an example of xml file using that NewXMLSchema.xml

I found the error is
<xs:element ref="ns1:DatosEspecificos" minOccurs="0"/>

Edited: to be specific

I remove minOccurs="0" and it worked because minOccurs="0" means Transmisiones should have no children TransmisionDatos

<xsd:element ref="tns:Transmisiones"/>

 
Igc Sa
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you both for your answers.
I had to leave this problem with a temporary solution (removing maxOccurs I got a simpler WSDL that generated an array of 1 element, or just a nested element inside the other) because I had a lot of other urgent stuff to do but I really appreciate your time and dedication.
However, I just changed the WDSL to remove minOccurs and still keep getting the same name for the array and the elements of the array:



The WSDL was provided by the client and I guess that the XML generated from it should be fine so I'm wondering if this is all a problem related to the tool I use to generate the code.
Maybe I should give a try to wsimport as Ivan Krizsan suggested, if I get back to the issue I'll keep you posted.

Thanks again to all of you for your help.
 
reply
    Bookmark Topic Watch Topic
  • New Topic