Hi

The main reason the generated schema is unreferenced is that
ResponseWrapper is not qualified with a namespace,
so no linking is possible. Add a namespace declaration to
@XmlRootElement or to package-info.java, and this should help with
generating a better WADL instance

Cheers, Sergey

On Mon, May 2, 2011 at 9:16 PM, yhu <[email protected]> wrote:
> Hi,
> I am newer to REST web service. Recently, I created a simple REST web
> service based on CXF 2.3.2:
>
> @Path("/luckynumbers")
> @Produces("text/plain")
> public class LuckyNumbers {
>
>    @GET
>    @Path("/getWADL")
>    @Produces("application/xml")
>    public ResponseWrapper getWADL(@QueryParam("") RequestWrapper arg) {
>        return new ResponseWrapper();
>    }
>
>
>
>    @XmlRootElement
>    public static class ResponseWrapper {
>
>        List<String> theList;
>        String theResponse;
>
>
>        public String getTheResponse() {
>            return theResponse;
>        }
>
>        public void setTheResponse(String theResponse) {
>            this.theResponse = theResponse;
>        }
>
>        @XmlElement(name="listItem")
>        public List<String> getTheList() {
>            return theList;
>        }
>
>        public void setTheList(List<String> theList) {
>            this.theList = theList;
>        }
>    }
>   @XmlRootElement
>    public static class RequestWrapper {
>        List<String> theList;
>        String theRequest;
>
>       @XmlElement(name="listItem")
>        public Collection<String> getTheList() {
>            return theList;
>        }
>
>        public void setTheList(List<String> theList) {
>            this.theList = theList;
>        }
>
>        public String getTheRequest() {
>            return theRequest;
>        }
>
>        public void setTheRequest(String theRequest) {
>            this.theRequest = theRequest;
>        }
>    }
> }
>
> The WADL is as below:
>
> <application xmlns="http://wadl.dev.java.net/2009/02";
> xmlns:xs="http://www.w3.org/2001/XMLSchema";><grammars><xs:schema
> xmlns:xs="http://www.w3.org/2001/XMLSchema";
> attributeFormDefault="unqualified" elementFormDefault="unqualified">
>    <xs:element name="responseWrapper" type="responseWrapper"/>
>    <xs:complexType name="responseWrapper">
>        <xs:sequence>
>            <xs:element maxOccurs="unbounded" minOccurs="0" name="listItem"
> type="xs:string"/>
>            <xs:element minOccurs="0" name="theResponse" type="xs:string"/>
>        </xs:sequence>
>    </xs:complexType>
> </xs:schema>
> </grammars><resources
> base="http://localhost:8080/ws-rest-prototype/services/LuckyNumbersRest";><resource
> path="/luckynumbers"><resource path="/getWADL"><method
> name="GET"><request></request><response><representation
> mediaType="application/xml"/></response></method></resource></resource></resources></application>
>
> We can see that requestWrapper is not generated in WADL, so we cannot
> publish such WADL to the client. The weird thing is that responseWrapper is
> generated, but RequestWrapper and ResponseWrapper are totally same except
> for the name.
>
> Can any one advice me how I can modify the code or configure so that the
> WADL can represent the web service completely? Thanks
>
> --
> View this message in context: 
> http://cxf.547215.n5.nabble.com/java-util-List-in-rquest-missed-in-WADL-tp4365634p4365634.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Reply via email to