wsdl2java - XmlBeans Binding does not handle collections/array properly
-----------------------------------------------------------------------
Key: CXF-3541
URL: https://issues.apache.org/jira/browse/CXF-3541
Project: CXF
Issue Type: Bug
Components: Tooling
Affects Versions: 2.3.4, 2.4
Reporter: Chun Zhang
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 {
@WebResult(name = "return", targetNamespace = "")
@RequestWrapper(localName = "getCustomersByName", targetNamespace =
"http://customerservice.example.com/",
className =
"com.example.customerservice.GetCustomersByNameDocument")
@WebMethod
@ResponseWrapper(localName = "getCustomersByNameResponse",
targetNamespace = "http://customerservice.example.com/",
className =
"com.example.customerservice.GetCustomersByNameResponseDocument")
public com.example.customerservice.Customer getCustomersByName(
@WebParam(name = "name", targetNamespace = "")
String name
) throws NoSuchCustomerException;
}
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.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira