You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Matias Urbieta <mu...@gpi.com.ar> on 2009/11/17 00:00:38 UTC

Unmarshalling problems with returned wrapped lists using xmlbeandatabinding

Hi, i'm currently facing a problem when i try to unmarchal .Net service
response using xmlbeandatabinding.
The issue arised when we change our aegis databinding strategy to
xmlbean one. 
The operation "getSucursalesResponse" returns a list of sucursales
wrapped with an element called  "getSucursalesResult" as you can see
following:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
   <soap:Body> 
      <getSucursalesResponse xmlns="http://ar/"> 
         <getSucursalesResult> 
            <Sucursales> 
               <codigoSucursal>1</codigoSucursal> 
               <descripcion>aaa</descripcion> 
            </Sucursales> 
            <Sucursales> 
               <codigoSucursal>2</codigoSucursal> 
               <descripcion>bbb</descripcion> 
            </Sucursales> 
      </getSucursalesResult> 
      </getSucursalesResponse> 
   </soap:Body> 
</soap:Envelope>

Our service interface is defined as:



@WebService(....)
@SOAPBinding(use = SOAPBinding.Use.LITERAL, parameterStyle =
SOAPBinding.ParameterStyle.WRAPPED)
public interface ServiceImpl extends Service {

@WebMethod(operationName="getSucursales",action =
"http://ar/getSucursales")
@WebResult(name = "getSucursalesResult", targetNamespace = "http://ar/")
    
public List<Sucursales> getSucursales() throws ServiceException;
    
}


the ws builder code is:

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setDataBinding(new JAXBDataBinding());
factory.getServiceFactory().setWrapped(true);
... 

failing with or without setwrapped().


do you know how to setup the wsproxyfactory in order to fix this issue? 


regards



Re: Unmarshalling problems with returned wrapped lists using xmlbeandatabinding

Posted by Daniel Kulp <dk...@apache.org>.
I'm a bit confused....   You mention xmlbeans, but then I see:

>factory.setDataBinding(new JAXBDataBinding())

In anycase, I would suggest making sure you use CXF 2.2.4 (or even the 2.2.5 
currently being voted on) and running the wsdl2java tool on the wsdl provided 
by the .NET service (you can use -db xmlbeans if you want xmlbeans).   That 
should produce code that would work.  

In your case, if you want that method signature, you would also need 
@RequestWrapper/@ResponseWrapper annoations to define the 
getSucursalesResponse wrapper element.

Dan


On Mon November 16 2009 6:00:38 pm Matias Urbieta wrote:
> Hi, i'm currently facing a problem when i try to unmarchal .Net service
> response using xmlbeandatabinding.
> The issue arised when we change our aegis databinding strategy to
> xmlbean one.
> The operation "getSucursalesResponse" returns a list of sucursales
> wrapped with an element called  "getSucursalesResult" as you can see
> following:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>    <soap:Body>
>       <getSucursalesResponse xmlns="http://ar/">
>          <getSucursalesResult>
>             <Sucursales>
>                <codigoSucursal>1</codigoSucursal>
>                <descripcion>aaa</descripcion>
>             </Sucursales>
>             <Sucursales>
>                <codigoSucursal>2</codigoSucursal>
>                <descripcion>bbb</descripcion>
>             </Sucursales>
>       </getSucursalesResult>
>       </getSucursalesResponse>
>    </soap:Body>
> </soap:Envelope>
> 
> Our service interface is defined as:
> 
> 
> 
> @WebService(....)
> @SOAPBinding(use = SOAPBinding.Use.LITERAL, parameterStyle =
> SOAPBinding.ParameterStyle.WRAPPED)
> public interface ServiceImpl extends Service {
> 
> @WebMethod(operationName="getSucursales",action =
> "http://ar/getSucursales")
> @WebResult(name = "getSucursalesResult", targetNamespace = "http://ar/")
> 
> public List<Sucursales> getSucursales() throws ServiceException;
> 
> }
> 
> 
> the ws builder code is:
> 
> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> factory.setDataBinding(new JAXBDataBinding());
> factory.getServiceFactory().setWrapped(true);
> ...
> 
> failing with or without setwrapped().
> 
> 
> do you know how to setup the wsproxyfactory in order to fix this issue?
> 
> 
> regards
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog