You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by da...@abis-reicom.de on 2008/10/01 15:40:38 UTC

WSDL2Java question: Wrapped Lists

Hello,

I'm developing a web service with the java first approach. My domain
model contains Hibernate annotations.
As I don't want to share them with my webservice client, I thought it
might be a good idea to use wsdl2java to generate a seperate model for
the client which has no Hibernate annotations.

There is just one thing I'm wondering about: Why does wsdl2java
generate wrapper classes for Java lists (e.g.: List<Customer>)?

Is there any annotation I could use to produce a WSDL file that doesn't
use wrappers for lists?

Thanks,

Fabian

Re: WSDL2Java question: Wrapped Lists

Posted by Christian Schneider <ch...@die-schneider.net>.
You should take a look at this Howto:
http://cwiki.apache.org/CXF20DOC/defining-contract-first-webservices-with-wsdl-generation-from-java.html

The service gnerated here will have plain lists that make nice use of 
generics.

Greetings

Christian

The generated CustomerService looks like this:

@WebService(targetNamespace = "http://customerservice.example.com/", 
name = "CustomerService")
@XmlSeeAlso({ObjectFactory.class})

public interface CustomerService {

/*
 *
 */

    @WebResult(name = "return", targetNamespace = "")
    @RequestWrapper(localName = "getCustomersByName", targetNamespace = 
"http://customerservice.example.com/", className = 
"com.example.customerservice.GetCustomersByName")
    @ResponseWrapper(localName = "getCustomersByNameResponse", 
targetNamespace = "http://customerservice.example.com/", className = 
"com.example.customerservice.GetCustomersByNameResponse")
    @WebMethod
    public java.util.List<com.example.customerservice.Customer> 
getCustomersByName(
        @WebParam(name = "name", targetNamespace = "")
        java.lang.String name
    ) throws NoSuchCustomerException;
}

dankof@abis-reicom.de schrieb:
> Hello,
>
> I'm developing a web service with the java first approach. My domain
> model contains Hibernate annotations.
> As I don't want to share them with my webservice client, I thought it
> might be a good idea to use wsdl2java to generate a seperate model for
> the client which has no Hibernate annotations.
>
> There is just one thing I'm wondering about: Why does wsdl2java
> generate wrapper classes for Java lists (e.g.: List<Customer>)?
>
> Is there any annotation I could use to produce a WSDL file that doesn't
> use wrappers for lists?
>
> Thanks,
>
> Fabian
>
>   


-- 

Christian Schneider
---
http://www.liquid-reality.de