'How to prevent unnecessary boxing while creating a jar from a WSDL using wsimport?

The output is like this and related methods use this wrapper class as a return type but instead of an unnecessary boxing I expect to see List<ItemVariantSpecType> as a return type.

I found something that might be related with this issue but it didn't work:

<jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>

whole wsimport command:

wsimport wsCreateShipment.wsdl -keep -clientjar UPSCreateShipment.jar  -d "UPSCargoService" -XadditionalHeaders -B-XautoNameResolution -b custom-binding.xml -J-Djavax.xml.accessExternalSchema=all -J-Djavax.xml.accessExternalDTD=all`

custom-binding.xml which i use in the wsimport command:

<jaxb:bindings version="2.0"
               xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
    <jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
        <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
    </jaxws:bindings>
    
    <jaxb:bindings>
        <jaxb:globalBindings generateElementProperty="false"/>
    </jaxb:bindings>
</jaxb:bindings>   

So is there a way to prevent this situation?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source