You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Charles Moulliard <cm...@gmail.com> on 2010/09/09 12:49:44 UTC

camel cxfbean & JAX-Rs & @QueryParam

Hi,

I try in my camel cxf bean to retrieve query parameters of my HTTP POST
request. No error is reported but I can get this property.

Request : curl.exe -i -X POST
http://localhost:9292/jway/validateForm?formID=profil

INFO: c149af70-d990-4746-8528-2d9ace11832a >>> (RestToSOAP) from(
http://localhost:9292) --> formRequestREST <<< Pattern:InOut,
Headers:{User-Agent=curl/7.20.0 (i686-pc-mi
ngw32) libcurl/7.20.0 OpenSSL/0.9.8k zlib/1.2.3,
CamelHttpCharacterEncoding=null, Content-Type=null, CamelHttpUrl=
http://localhost:9292/jway/validateForm, CamelHttpPath=/
jway/validateForm, CamelHttpMethod=POST, Host=localhost:9292,
CamelHttpQuery=formID=profil, Accept=*/*, formID=profil,
CamelHttpUri=/jway/validateForm},

>From the trace, we can see that the query parameter of the request is there
--> formID=profil but the object returned does not contain this info

    @POST
    @Path("/validateForm")
    public Response validateForm(
            @QueryParam("formID") String formID,
            @QueryParam("dataID") String dataID,
            @QueryParam("draftID") String draftID,
            @QueryParam("userID") String userID,
            @QueryParam("draftData") String draftData) {

        Form form = new Form();
        form.setFormID(formID);
        form.setDataID(dataID);
        form.setDraftID(draftID);
        form.setUserID(userID);
        form.setAction("VALIDATE");
        form.setDraftData(draftData);

        producer.sendBodyAndHeader(URI_DIRECT, form, "ACTION", "VALIDATE");
        return Response.ok(form).build();
    }

--> return :

<?xml version="1.0" encoding="UTF-8"
standalone="yes"?><Form><action>VALIDATE</action></Form>

Regards,

Charles Moulliard

Senior Enterprise Architect (J2EE, .NET, SOA)
Apache Camel - Karaf - ServiceMix Committer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Blog : http://cmoulliard.blogspot.com |  Twitter :
http://twitter.com/cmoulliard
Linkedin : http://www.linkedin.com/in/charlesmoulliard | Skype: cmoulliard

Re: camel cxfbean & JAX-Rs & @QueryParam

Posted by Willem Jiang <wi...@gmail.com>.
Hi Charles,

It's a bug[1] of camel-cxfbeans component, I just committed a patch for it.
Please check out the latest Camel trunk, and verify it the fix.
[1]https://issues.apache.org/activemq/browse/CAMEL-3113


Willem
On 9/9/10 8:39 PM, Charles Moulliard wrote:
> I will add end of the day a new test case for cxfbean in camel-cxf project.
> So you will be able to see what happens. I work for a client this week so
> cannot dig the code.
>
> On Thu, Sep 9, 2010 at 2:27 PM, Willem Jiang<wi...@gmail.com>  wrote:
>
>> Maybe it's the @QureyParam mapping thing.
>> Can you create a JIRA and submit a small test case?
>> I will look this issue tomorrow.
>>
>> Willem
>>
>>
>> On 9/9/10 7:57 PM, Charles Moulliard wrote:
>>
>>> the param formID is null
>>>
>>> On Thu, Sep 9, 2010 at 1:28 PM, Willem Jiang<wi...@gmail.com>
>>>   wrote:
>>>
>>>   On 9/9/10 6:49 PM, Charles Moulliard wrote:
>>>>
>>>>   Hi,
>>>>>
>>>>> I try in my camel cxf bean to retrieve query parameters of my HTTP POST
>>>>> request. No error is reported but I can get this property.
>>>>>
>>>>> Request : curl.exe -i -X POST
>>>>> http://localhost:9292/jway/validateForm?formID=profil
>>>>>
>>>>> INFO: c149af70-d990-4746-8528-2d9ace11832a>>>    (RestToSOAP) from(
>>>>> http://localhost:9292) -->    formRequestREST<<<    Pattern:InOut,
>>>>> Headers:{User-Agent=curl/7.20.0 (i686-pc-mi
>>>>> ngw32) libcurl/7.20.0 OpenSSL/0.9.8k zlib/1.2.3,
>>>>> CamelHttpCharacterEncoding=null, Content-Type=null, CamelHttpUrl=
>>>>> http://localhost:9292/jway/validateForm, CamelHttpPath=/
>>>>> jway/validateForm, CamelHttpMethod=POST, Host=localhost:9292,
>>>>> CamelHttpQuery=formID=profil, Accept=*/*, formID=profil,
>>>>> CamelHttpUri=/jway/validateForm},
>>>>>
>>>>>   From the trace, we can see that the query parameter of the request is
>>>>>
>>>>>> there
>>>>>>
>>>>>>   -->    formID=profil but the object returned does not contain this info
>>>>>
>>>>>      @POST
>>>>>      @Path("/validateForm")
>>>>>      public Response validateForm(
>>>>>              @QueryParam("formID") String formID,
>>>>>              @QueryParam("dataID") String dataID,
>>>>>              @QueryParam("draftID") String draftID,
>>>>>              @QueryParam("userID") String userID,
>>>>>              @QueryParam("draftData") String draftData) {
>>>>>
>>>>>          Form form = new Form();
>>>>>          form.setFormID(formID);
>>>>>          form.setDataID(dataID);
>>>>>          form.setDraftID(draftID);
>>>>>          form.setUserID(userID);
>>>>>          form.setAction("VALIDATE");
>>>>>          form.setDraftData(draftData);
>>>>>
>>>>>          producer.sendBodyAndHeader(URI_DIRECT, form, "ACTION",
>>>>> "VALIDATE");
>>>>>          return Response.ok(form).build();
>>>>>      }
>>>>>
>>>>> -->    return :
>>>>>
>>>>>
>>>> Can you try to write some log in the validateForm to see if the fromID
>>>> has
>>>> the value ?
>>>>
>>>> If it's null, that could be a bug of camel cxf bean.
>>>>
>>>>
>>>>
>>>>   <?xml version="1.0" encoding="UTF-8"
>>>>> standalone="yes"?><Form><action>VALIDATE</action></Form>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Charles Moulliard
>>>>>
>>>>> Senior Enterprise Architect (J2EE, .NET, SOA)
>>>>> Apache Camel - Karaf - ServiceMix Committer
>>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>> Blog : http://cmoulliard.blogspot.com |  Twitter :
>>>>> http://twitter.com/cmoulliard
>>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard | Skype:
>>>>> cmoulliard
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>


Re: camel cxfbean & JAX-Rs & @QueryParam

Posted by Charles Moulliard <cm...@gmail.com>.
I will add end of the day a new test case for cxfbean in camel-cxf project.
So you will be able to see what happens. I work for a client this week so
cannot dig the code.

On Thu, Sep 9, 2010 at 2:27 PM, Willem Jiang <wi...@gmail.com> wrote:

> Maybe it's the @QureyParam mapping thing.
> Can you create a JIRA and submit a small test case?
> I will look this issue tomorrow.
>
> Willem
>
>
> On 9/9/10 7:57 PM, Charles Moulliard wrote:
>
>> the param formID is null
>>
>> On Thu, Sep 9, 2010 at 1:28 PM, Willem Jiang<wi...@gmail.com>
>>  wrote:
>>
>>  On 9/9/10 6:49 PM, Charles Moulliard wrote:
>>>
>>>  Hi,
>>>>
>>>> I try in my camel cxf bean to retrieve query parameters of my HTTP POST
>>>> request. No error is reported but I can get this property.
>>>>
>>>> Request : curl.exe -i -X POST
>>>> http://localhost:9292/jway/validateForm?formID=profil
>>>>
>>>> INFO: c149af70-d990-4746-8528-2d9ace11832a>>>   (RestToSOAP) from(
>>>> http://localhost:9292) -->   formRequestREST<<<   Pattern:InOut,
>>>> Headers:{User-Agent=curl/7.20.0 (i686-pc-mi
>>>> ngw32) libcurl/7.20.0 OpenSSL/0.9.8k zlib/1.2.3,
>>>> CamelHttpCharacterEncoding=null, Content-Type=null, CamelHttpUrl=
>>>> http://localhost:9292/jway/validateForm, CamelHttpPath=/
>>>> jway/validateForm, CamelHttpMethod=POST, Host=localhost:9292,
>>>> CamelHttpQuery=formID=profil, Accept=*/*, formID=profil,
>>>> CamelHttpUri=/jway/validateForm},
>>>>
>>>>  From the trace, we can see that the query parameter of the request is
>>>>
>>>>> there
>>>>>
>>>>>  -->   formID=profil but the object returned does not contain this info
>>>>
>>>>     @POST
>>>>     @Path("/validateForm")
>>>>     public Response validateForm(
>>>>             @QueryParam("formID") String formID,
>>>>             @QueryParam("dataID") String dataID,
>>>>             @QueryParam("draftID") String draftID,
>>>>             @QueryParam("userID") String userID,
>>>>             @QueryParam("draftData") String draftData) {
>>>>
>>>>         Form form = new Form();
>>>>         form.setFormID(formID);
>>>>         form.setDataID(dataID);
>>>>         form.setDraftID(draftID);
>>>>         form.setUserID(userID);
>>>>         form.setAction("VALIDATE");
>>>>         form.setDraftData(draftData);
>>>>
>>>>         producer.sendBodyAndHeader(URI_DIRECT, form, "ACTION",
>>>> "VALIDATE");
>>>>         return Response.ok(form).build();
>>>>     }
>>>>
>>>> -->   return :
>>>>
>>>>
>>> Can you try to write some log in the validateForm to see if the fromID
>>> has
>>> the value ?
>>>
>>> If it's null, that could be a bug of camel cxf bean.
>>>
>>>
>>>
>>>  <?xml version="1.0" encoding="UTF-8"
>>>> standalone="yes"?><Form><action>VALIDATE</action></Form>
>>>>
>>>> Regards,
>>>>
>>>> Charles Moulliard
>>>>
>>>> Senior Enterprise Architect (J2EE, .NET, SOA)
>>>> Apache Camel - Karaf - ServiceMix Committer
>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>> Blog : http://cmoulliard.blogspot.com |  Twitter :
>>>> http://twitter.com/cmoulliard
>>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard | Skype:
>>>> cmoulliard
>>>>
>>>>
>>>>
>>>
>>
>

Re: camel cxfbean & JAX-Rs & @QueryParam

Posted by Willem Jiang <wi...@gmail.com>.
Maybe it's the @QureyParam mapping thing.
Can you create a JIRA and submit a small test case?
I will look this issue tomorrow.

Willem

On 9/9/10 7:57 PM, Charles Moulliard wrote:
> the param formID is null
>
> On Thu, Sep 9, 2010 at 1:28 PM, Willem Jiang<wi...@gmail.com>  wrote:
>
>> On 9/9/10 6:49 PM, Charles Moulliard wrote:
>>
>>> Hi,
>>>
>>> I try in my camel cxf bean to retrieve query parameters of my HTTP POST
>>> request. No error is reported but I can get this property.
>>>
>>> Request : curl.exe -i -X POST
>>> http://localhost:9292/jway/validateForm?formID=profil
>>>
>>> INFO: c149af70-d990-4746-8528-2d9ace11832a>>>   (RestToSOAP) from(
>>> http://localhost:9292) -->   formRequestREST<<<   Pattern:InOut,
>>> Headers:{User-Agent=curl/7.20.0 (i686-pc-mi
>>> ngw32) libcurl/7.20.0 OpenSSL/0.9.8k zlib/1.2.3,
>>> CamelHttpCharacterEncoding=null, Content-Type=null, CamelHttpUrl=
>>> http://localhost:9292/jway/validateForm, CamelHttpPath=/
>>> jway/validateForm, CamelHttpMethod=POST, Host=localhost:9292,
>>> CamelHttpQuery=formID=profil, Accept=*/*, formID=profil,
>>> CamelHttpUri=/jway/validateForm},
>>>
>>>   From the trace, we can see that the query parameter of the request is
>>>> there
>>>>
>>> -->   formID=profil but the object returned does not contain this info
>>>
>>>      @POST
>>>      @Path("/validateForm")
>>>      public Response validateForm(
>>>              @QueryParam("formID") String formID,
>>>              @QueryParam("dataID") String dataID,
>>>              @QueryParam("draftID") String draftID,
>>>              @QueryParam("userID") String userID,
>>>              @QueryParam("draftData") String draftData) {
>>>
>>>          Form form = new Form();
>>>          form.setFormID(formID);
>>>          form.setDataID(dataID);
>>>          form.setDraftID(draftID);
>>>          form.setUserID(userID);
>>>          form.setAction("VALIDATE");
>>>          form.setDraftData(draftData);
>>>
>>>          producer.sendBodyAndHeader(URI_DIRECT, form, "ACTION",
>>> "VALIDATE");
>>>          return Response.ok(form).build();
>>>      }
>>>
>>> -->   return :
>>>
>>
>> Can you try to write some log in the validateForm to see if the fromID has
>> the value ?
>>
>> If it's null, that could be a bug of camel cxf bean.
>>
>>
>>
>>> <?xml version="1.0" encoding="UTF-8"
>>> standalone="yes"?><Form><action>VALIDATE</action></Form>
>>>
>>> Regards,
>>>
>>> Charles Moulliard
>>>
>>> Senior Enterprise Architect (J2EE, .NET, SOA)
>>> Apache Camel - Karaf - ServiceMix Committer
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> Blog : http://cmoulliard.blogspot.com |  Twitter :
>>> http://twitter.com/cmoulliard
>>> Linkedin : http://www.linkedin.com/in/charlesmoulliard | Skype:
>>> cmoulliard
>>>
>>>
>>
>


Re: camel cxfbean & JAX-Rs & @QueryParam

Posted by Charles Moulliard <cm...@gmail.com>.
the param formID is null

On Thu, Sep 9, 2010 at 1:28 PM, Willem Jiang <wi...@gmail.com> wrote:

> On 9/9/10 6:49 PM, Charles Moulliard wrote:
>
>> Hi,
>>
>> I try in my camel cxf bean to retrieve query parameters of my HTTP POST
>> request. No error is reported but I can get this property.
>>
>> Request : curl.exe -i -X POST
>> http://localhost:9292/jway/validateForm?formID=profil
>>
>> INFO: c149af70-d990-4746-8528-2d9ace11832a>>>  (RestToSOAP) from(
>> http://localhost:9292) -->  formRequestREST<<<  Pattern:InOut,
>> Headers:{User-Agent=curl/7.20.0 (i686-pc-mi
>> ngw32) libcurl/7.20.0 OpenSSL/0.9.8k zlib/1.2.3,
>> CamelHttpCharacterEncoding=null, Content-Type=null, CamelHttpUrl=
>> http://localhost:9292/jway/validateForm, CamelHttpPath=/
>> jway/validateForm, CamelHttpMethod=POST, Host=localhost:9292,
>> CamelHttpQuery=formID=profil, Accept=*/*, formID=profil,
>> CamelHttpUri=/jway/validateForm},
>>
>>  From the trace, we can see that the query parameter of the request is
>>> there
>>>
>> -->  formID=profil but the object returned does not contain this info
>>
>>     @POST
>>     @Path("/validateForm")
>>     public Response validateForm(
>>             @QueryParam("formID") String formID,
>>             @QueryParam("dataID") String dataID,
>>             @QueryParam("draftID") String draftID,
>>             @QueryParam("userID") String userID,
>>             @QueryParam("draftData") String draftData) {
>>
>>         Form form = new Form();
>>         form.setFormID(formID);
>>         form.setDataID(dataID);
>>         form.setDraftID(draftID);
>>         form.setUserID(userID);
>>         form.setAction("VALIDATE");
>>         form.setDraftData(draftData);
>>
>>         producer.sendBodyAndHeader(URI_DIRECT, form, "ACTION",
>> "VALIDATE");
>>         return Response.ok(form).build();
>>     }
>>
>> -->  return :
>>
>
> Can you try to write some log in the validateForm to see if the fromID has
> the value ?
>
> If it's null, that could be a bug of camel cxf bean.
>
>
>
>> <?xml version="1.0" encoding="UTF-8"
>> standalone="yes"?><Form><action>VALIDATE</action></Form>
>>
>> Regards,
>>
>> Charles Moulliard
>>
>> Senior Enterprise Architect (J2EE, .NET, SOA)
>> Apache Camel - Karaf - ServiceMix Committer
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> Blog : http://cmoulliard.blogspot.com |  Twitter :
>> http://twitter.com/cmoulliard
>> Linkedin : http://www.linkedin.com/in/charlesmoulliard | Skype:
>> cmoulliard
>>
>>
>

Re: camel cxfbean & JAX-Rs & @QueryParam

Posted by Willem Jiang <wi...@gmail.com>.
On 9/9/10 6:49 PM, Charles Moulliard wrote:
> Hi,
>
> I try in my camel cxf bean to retrieve query parameters of my HTTP POST
> request. No error is reported but I can get this property.
>
> Request : curl.exe -i -X POST
> http://localhost:9292/jway/validateForm?formID=profil
>
> INFO: c149af70-d990-4746-8528-2d9ace11832a>>>  (RestToSOAP) from(
> http://localhost:9292) -->  formRequestREST<<<  Pattern:InOut,
> Headers:{User-Agent=curl/7.20.0 (i686-pc-mi
> ngw32) libcurl/7.20.0 OpenSSL/0.9.8k zlib/1.2.3,
> CamelHttpCharacterEncoding=null, Content-Type=null, CamelHttpUrl=
> http://localhost:9292/jway/validateForm, CamelHttpPath=/
> jway/validateForm, CamelHttpMethod=POST, Host=localhost:9292,
> CamelHttpQuery=formID=profil, Accept=*/*, formID=profil,
> CamelHttpUri=/jway/validateForm},
>
>> From the trace, we can see that the query parameter of the request is there
> -->  formID=profil but the object returned does not contain this info
>
>      @POST
>      @Path("/validateForm")
>      public Response validateForm(
>              @QueryParam("formID") String formID,
>              @QueryParam("dataID") String dataID,
>              @QueryParam("draftID") String draftID,
>              @QueryParam("userID") String userID,
>              @QueryParam("draftData") String draftData) {
>
>          Form form = new Form();
>          form.setFormID(formID);
>          form.setDataID(dataID);
>          form.setDraftID(draftID);
>          form.setUserID(userID);
>          form.setAction("VALIDATE");
>          form.setDraftData(draftData);
>
>          producer.sendBodyAndHeader(URI_DIRECT, form, "ACTION", "VALIDATE");
>          return Response.ok(form).build();
>      }
>
> -->  return :

Can you try to write some log in the validateForm to see if the fromID 
has the value ?

If it's null, that could be a bug of camel cxf bean.

>
> <?xml version="1.0" encoding="UTF-8"
> standalone="yes"?><Form><action>VALIDATE</action></Form>
>
> Regards,
>
> Charles Moulliard
>
> Senior Enterprise Architect (J2EE, .NET, SOA)
> Apache Camel - Karaf - ServiceMix Committer
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Blog : http://cmoulliard.blogspot.com |  Twitter :
> http://twitter.com/cmoulliard
> Linkedin : http://www.linkedin.com/in/charlesmoulliard | Skype: cmoulliard
>