When you have @QueryParam("") then you should have query parameters
such as 'theRequest' because they are simple properties of
RequestWrapper. List<String> is ignored because it is not cleat to me
how this can be represented as a query parameter...

Actually, that can be represented as a query parameter 'theList' with
'repeating' attribute (available in WADL schema) added...I can
definitely make sure explicit List<String> QueryParams are represented
that way....

Cheers, Sergey

On Tue, May 3, 2011 at 9:55 PM, Sergey Beryozkin <[email protected]> wrote:
> Hi
>
> ok, I understand now. Adding a @QueryParam to RequestWrapper means
> that request query  parameters will need to
> be injected into an instance of RequestWrapper. In this case
> RequestWrapper does not represent a request body and thus no grammar
> is generated for it.
>
> If you remove @QueryParam then the server expects an XML payload coming in
>
> Does it help ?
> Sergey
>
> On Tue, May 3, 2011 at 8:17 PM, yhu <[email protected]> wrote:
>> Thanks Sergey, you answered the question I plan to to ask  I will check if it
>> work.
>>
>> My original question may be not clear, so I refine it and hope you can help.
>>
>> I have a simple RESTful web service class:
>> @Path("/luckynumbers")
>> @Produces("text/plain")
>> public class LuckyNumbers {
>>    @GET
>>    @Path("/getWADL")
>>    @Produces("application/xml")
>>    @Consumes("application/xml")
>>    public String getWADL(@QueryParam("")RequestWrapper arg) {
>>        System.out.println(arg);
>>        return arg.toString();
>>    }
>>
>>   @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;
>>        }
>>
>>       @Override
>>       public String toString() {
>>           return "RequestWrapper{" +
>>                   "theList=" + theList +
>>                   ", theRequest='" + theRequest + '\'' +
>>                   '}';
>>       }
>>   }
>> }
>>
>> And the generated WADL (using _?wadl in IE) is:
>>  <application xmlns="http://wadl.dev.java.net/2009/02";
>> xmlns:xs="http://www.w3.org/2001/XMLSchema";>
>>  <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">
>>
>>  </representation>
>>  </response>
>>  </method>
>>  </resource>
>>  </resource>
>>  </resources>
>>  </application>
>>
>> The problem of the WADL is that "theList" in requestWrapper is not
>> generated.
>>
>> I find it is @QueryParam of the method argument causes this, if I remove it,
>> the WADL seems good. But without @QueryParam, the web service call fails.
>> What is your suggestion?
>>
>> --
>> View this message in context: 
>> http://cxf.547215.n5.nabble.com/java-util-List-in-rquest-missed-in-WADL-tp4365634p4368122.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