How to get rid of ArrayOfString classes from jax-ws client code

When creating client code from WSDL using wsimport, I get many ArrayOf *** classes. I want to make sure that instead of ArrayOfString I get String [].

What external customization needs to be done to achieve this?

+5
source share
2 answers

At the moment, I have made a workaround by changing the ArrayOfXXX object to XXX [] using reflection in the utility.

+2
source

I'm not sure if this is what you are asking for, but if you see them in your XML response, you are probably misusing the methods of the ObjectFactory class created by JAX-WS.

For example, two lines of code below

factory.createArrayOfNameListItem(factory.createArrayOfNameListItem());

factory.createMyDataItemNames(arrayOfNameListItem);

create objects of the same type:

JAXBElement<ArrayOfNameListItem> objects

However

factory.createArrayOfNameListItem(factory.createArrayOfNameListItem());

/ :

<ArrayOfNameListItem>
<Names>
  <NameListItem>
    <FirstName>
      Homer
    </FirstName>
    <LastName>
      Simpson
    </LastName>
  </NameListItem>
</Names>
</ArrayOfNameListItem>

factory.createMyDataItemNames(arrayOfNameListItem);

/ :

<Names>
  <NameListItem>
    <FirstName>
      Homer
    </FirstName>
    <LastName>
      Simpson
    </LastName>
  </NameListItem>
</Names>

, -.

-1

All Articles