Reputation: 528
When generating the client code from a WSDL using wsimport I am getting lot of ArrayOf*** classes. I want to make sure that I get String[] instead of ArrayOfString.
What external customization needs to be done to achieve this?
Upvotes: 5
Views: 996
Reputation: 6280
I am not sure if this is what you are asking, but if you are seeing these in your xml response, you are probably misusing the methods in the ObjectFactory class generated by JAX-WS.
For example, the two lines of code below
factory.createArrayOfNameListItem(factory.createArrayOfNameListItem());
factory.createMyDataItemNames(arrayOfNameListItem);
produce objects of the same type:
JAXBElement<ArrayOfNameListItem> objects
however
factory.createArrayOfNameListItem(factory.createArrayOfNameListItem());
serialises / renders as:
<ArrayOfNameListItem>
<Names>
<NameListItem>
<FirstName>
Homer
</FirstName>
<LastName>
Simpson
</LastName>
</NameListItem>
</Names>
</ArrayOfNameListItem>
and
factory.createMyDataItemNames(arrayOfNameListItem);
serialises / renders as:
<Names>
<NameListItem>
<FirstName>
Homer
</FirstName>
<LastName>
Simpson
</LastName>
</NameListItem>
</Names>
Hope this helps someone.
Upvotes: 0
Reputation: 528
As of now I have done a workaround by modifying the ArrayOfXXX object in to XXX[] by using reflection in an utility method.
Upvotes: 2