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

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        4d 8h 34m 1 Daniel Kulp 25/May/11 02:03
        Resolved Resolved Closed Closed
        75d 13h 39m 1 Daniel Kulp 08/Aug/11 15:43
        Daniel Kulp made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Daniel Kulp made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Daniel Kulp [ dkulp ]
        Fix Version/s 2.4.1 [ 12316354 ]
        Fix Version/s 2.3.5 [ 12316355 ]
        Resolution Fixed [ 1 ]
        Chun Zhang created 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