Description
Generated Java code using CXF wsdl2java with xmlbeans databinding contains wrong return type for collections/arrays.
To reproduce the problem.
1. Use CustomerService.wsdl file from the wsdl_first sample.
2. Run wsdl2java without a binding file.
3. Look at the generated interface CustomerService.java
The generated code for getCustomersByName operation on CustomerService service is shown below
@WebService(targetNamespace = "http://customerservice.example.com/", name = "CustomerService")
@DataBinding(org.apache.cxf.xmlbeans.XmlBeansDataBinding.class)
public interface CustomerService
Note that the getCustomersByName () method returns Customer object.
Based on the CusotmerService.wsdl, it should return a list of Customers or the wrapper GetCustomersByNameResponse object.
Workaround (Credit Daniel Kulp):
You can flip it to BARE mode by creating a small binding file containing:
<jaxws:bindings
wsdlLocation="CustomerService.wsdl"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
<jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
</jaxws:bindings>
and passing that to wsdl2java via the -b flag. That would force the BARE
mode and wouldn't attempt the unwrapping.