CXF
  1. CXF
  2. CXF-3541

wsdl2java - XmlBeans Binding does not handle collections/array properly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.4, 2.3.4
    • Fix Version/s: 2.4.1, 2.3.5
    • Component/s: Tooling
    • Labels:
      None

      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

      { @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.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Daniel Kulp
            Reporter:
            Chun Zhang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development