You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Chun Zhang <cz...@cambian.com> on 2011/05/19 21:43:56 UTC
How to use xmlbeans databinding in CXF wsdl2java?
Hello,
I need to generate Java code using CXF wsdl2java with xmlbeans databinding.
I tried it using the CustomerService.wsdl file from the wsdl_first sample.
See attached file.
I got the following generated code for the CustomerService interface. Here
is partial code. See attached CustomerService.java file for complete code
listing.
@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 in the generated code, the getCustomersByName () method returns
Customer object. Based on the CusotmerService.wsdl, it should return a list
of Customers or the wrapper GetCustomersByNameResponse object. What can I
do to make wsdl2java generate the correct interface.
Thank you for your help!
Regards,
Chun Zhang
Re: How to use xmlbeans databinding in CXF wsdl2java?
Posted by Daniel Kulp <dk...@apache.org>.
This looks like a bug in the XMLBeans databinding. It looks like it cannot
handle the collections/arrays for the unwrapping cases. Can you log an issue?
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.
Dan
On Thursday, May 19, 2011 3:43:56 PM Chun Zhang wrote:
> Hello,
>
> I need to generate Java code using CXF wsdl2java with xmlbeans databinding.
>
> I tried it using the CustomerService.wsdl file from the wsdl_first sample.
> See attached file.
>
> I got the following generated code for the CustomerService interface. Here
> is partial code. See attached CustomerService.java file for complete code
> listing.
>
> @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 in the generated code, the getCustomersByName () method returns
> Customer object. Based on the CusotmerService.wsdl, it should return a list
> of Customers or the wrapper GetCustomersByNameResponse object. What can I
> do to make wsdl2java generate the correct interface.
>
> Thank you for your help!
> Regards,
> Chun Zhang
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com