You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Vishal.a" <vi...@gmail.com> on 2009/04/17 05:50:48 UTC

JAXRS: Problems with POST

Hello All,

I am trying to haave multiple POST methods something like this

@POST
@Path("/groups")
public Summary insertGroup(Group group)

and

@POST
@Path("/groups/{id}/users")
public void addUsersToGroup(@PathParam("id")UUID groupId,
                                ListWrapper<UUID> userIds)

The POST call to first method works absolutely fine,however call to the
addUsersToGroup method fails.
What could i be doing wrong?

Thanks,
Vishal
-- 
View this message in context: http://www.nabble.com/JAXRS%3A-Problems-with-POST-tp23090556p23090556.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: JAXRS: Problems with POST

Posted by "Vishal.a" <vi...@gmail.com>.
Hello Sergey,

MessageBodyReader did the trick.
But i have a different problem now,as you can see my listwrapper is nothing
but wrapper for a list,so i have a list of uuid within it.However when i
look at the list it actually contains a list of string representation for
uuid instead of the actual uuid.

This happens for both jaxws and jaxrs.So If i try to loop over the list of
uuid,it says 

java.lang.String cannot be cast to java.util.UUID


Thanks,
Vishal


Sergey Beryozkin-2 wrote:
> 
> Thanks Gabo...Yes, UUID is supported because it has a fromString()
> method...
> 
> Vishal - do you have a MessageBodyReader for ListWrapper<UUID> registered
> ?
> 
> Cheers, Sergey
> 
> 
> ----- Original Message ----- 
> From: "Gabo Manuel" <km...@solegysystems.com>
> To: <us...@cxf.apache.org>
> Sent: Friday, April 17, 2009 7:47 AM
> Subject: Re: JAXRS: Problems with POST
> 
> 
>> Hi Vishal,
>> 
>> I am not sure if CXF is capable of translating String to UUID directly. 
>> Could you try changing the parameter to type String instead of UUID? See 
>> if that works?
>> 
>> Hth.
>> 
>> Gabo
>> 
>> Vishal.a wrote:
>>> Hello Gabo,
>>>
>>> Here is the output from tcpmon
>>>
>>> POST
>>> /rest/peopleservice/groups/014773b8-b3a6-4c92-95be-97b760ff20d2/users
>>> HTTP/1.1
>>> Content-Length: 424
>>> Content-Type: application/xml; charset=UTF-8
>>> Host: localhost:8080
>>> Connection: Keep-Alive
>>> User-Agent: Apache-HttpClient/4.0-beta2 (java 1.5)
>>> Expect: 100-Continue
>>>
>>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>>    <listWrapper>
>>>       <_data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>> xsi:type="xs:string">2a849ceb-205a-4bdf-921b-f215b78642bf</_data>
>>>       <_data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>> xsi:type="xs:string">c3ae8ba3-1ea2-4ef6-a813-c7656a6334f1</_data>
>>>    </listWrapper>
>>>
>>> I can see the request going in from the logging interceptor for
>>> jaxrs,but
>>> the method is not invoked.
>>>
>>> Thanks,
>>> Vishal
>>>
>>>
>>>
>>> Gabo Manuel wrote:
>>>   
>>>> Hi Vishal,
>>>>
>>>> In what way does the call to the second method fail? Does it get 
>>>> invoked? Are the parameters empty or null? Was the post request
>>>> properly 
>>>> structured (you can check using tcpmon or some similar tool)?
>>>>
>>>> Gabo
>>>>
>>>> Vishal.a wrote:
>>>>     
>>>>> Hello All,
>>>>>
>>>>> I am trying to haave multiple POST methods something like this
>>>>>
>>>>> @POST
>>>>> @Path("/groups")
>>>>> public Summary insertGroup(Group group)
>>>>>
>>>>> and
>>>>>
>>>>> @POST
>>>>> @Path("/groups/{id}/users")
>>>>> public void addUsersToGroup(@PathParam("id")UUID groupId,
>>>>>                                 ListWrapper<UUID> userIds)
>>>>>
>>>>> The POST call to first method works absolutely fine,however call to
>>>>> the
>>>>> addUsersToGroup method fails.
>>>>> What could i be doing wrong?
>>>>>
>>>>> Thanks,
>>>>> Vishal
>>>>>   
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>>
>>>>> No virus found in this incoming message.
>>>>> Checked by AVG - www.avg.com 
>>>>> Version: 8.0.238 / Virus Database: 270.11.58/2061 - Release Date:
>>>>> 04/15/09 19:52:00
>>>>>
>>>>>   
>>>>>       
>>>>     
>>>
>>>   
>>> ------------------------------------------------------------------------
>>>
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG - www.avg.com 
>>> Version: 8.0.238 / Virus Database: 270.11.59/2063 - Release Date:
>>> 04/16/09 16:38:00
>>>
>>>
> 
> 

-- 
View this message in context: http://www.nabble.com/JAXRS%3A-Problems-with-POST-tp23090556p23109914.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: JAXRS: Problems with POST

Posted by Sergey Beryozkin <sb...@progress.com>.
Thanks Gabo...Yes, UUID is supported because it has a fromString() method...

Vishal - do you have a MessageBodyReader for ListWrapper<UUID> registered ?

Cheers, Sergey


----- Original Message ----- 
From: "Gabo Manuel" <km...@solegysystems.com>
To: <us...@cxf.apache.org>
Sent: Friday, April 17, 2009 7:47 AM
Subject: Re: JAXRS: Problems with POST


> Hi Vishal,
> 
> I am not sure if CXF is capable of translating String to UUID directly. 
> Could you try changing the parameter to type String instead of UUID? See 
> if that works?
> 
> Hth.
> 
> Gabo
> 
> Vishal.a wrote:
>> Hello Gabo,
>>
>> Here is the output from tcpmon
>>
>> POST /rest/peopleservice/groups/014773b8-b3a6-4c92-95be-97b760ff20d2/users
>> HTTP/1.1
>> Content-Length: 424
>> Content-Type: application/xml; charset=UTF-8
>> Host: localhost:8080
>> Connection: Keep-Alive
>> User-Agent: Apache-HttpClient/4.0-beta2 (java 1.5)
>> Expect: 100-Continue
>>
>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>    <listWrapper>
>>       <_data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> xsi:type="xs:string">2a849ceb-205a-4bdf-921b-f215b78642bf</_data>
>>       <_data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> xsi:type="xs:string">c3ae8ba3-1ea2-4ef6-a813-c7656a6334f1</_data>
>>    </listWrapper>
>>
>> I can see the request going in from the logging interceptor for jaxrs,but
>> the method is not invoked.
>>
>> Thanks,
>> Vishal
>>
>>
>>
>> Gabo Manuel wrote:
>>   
>>> Hi Vishal,
>>>
>>> In what way does the call to the second method fail? Does it get 
>>> invoked? Are the parameters empty or null? Was the post request properly 
>>> structured (you can check using tcpmon or some similar tool)?
>>>
>>> Gabo
>>>
>>> Vishal.a wrote:
>>>     
>>>> Hello All,
>>>>
>>>> I am trying to haave multiple POST methods something like this
>>>>
>>>> @POST
>>>> @Path("/groups")
>>>> public Summary insertGroup(Group group)
>>>>
>>>> and
>>>>
>>>> @POST
>>>> @Path("/groups/{id}/users")
>>>> public void addUsersToGroup(@PathParam("id")UUID groupId,
>>>>                                 ListWrapper<UUID> userIds)
>>>>
>>>> The POST call to first method works absolutely fine,however call to the
>>>> addUsersToGroup method fails.
>>>> What could i be doing wrong?
>>>>
>>>> Thanks,
>>>> Vishal
>>>>   
>>>> ------------------------------------------------------------------------
>>>>
>>>>
>>>> No virus found in this incoming message.
>>>> Checked by AVG - www.avg.com 
>>>> Version: 8.0.238 / Virus Database: 270.11.58/2061 - Release Date:
>>>> 04/15/09 19:52:00
>>>>
>>>>   
>>>>       
>>>     
>>
>>   
>> ------------------------------------------------------------------------
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com 
>> Version: 8.0.238 / Virus Database: 270.11.59/2063 - Release Date: 04/16/09 16:38:00
>>
>>

Re: JAXRS: Problems with POST

Posted by Gabo Manuel <km...@solegysystems.com>.
Hi Vishal,

I am not sure if CXF is capable of translating String to UUID directly. 
Could you try changing the parameter to type String instead of UUID? See 
if that works?

Hth.

Gabo

Vishal.a wrote:
> Hello Gabo,
>
> Here is the output from tcpmon
>
> POST /rest/peopleservice/groups/014773b8-b3a6-4c92-95be-97b760ff20d2/users
> HTTP/1.1
> Content-Length: 424
> Content-Type: application/xml; charset=UTF-8
> Host: localhost:8080
> Connection: Keep-Alive
> User-Agent: Apache-HttpClient/4.0-beta2 (java 1.5)
> Expect: 100-Continue
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>    <listWrapper>
>       <_data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xsi:type="xs:string">2a849ceb-205a-4bdf-921b-f215b78642bf</_data>
>       <_data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xsi:type="xs:string">c3ae8ba3-1ea2-4ef6-a813-c7656a6334f1</_data>
>    </listWrapper>
>
> I can see the request going in from the logging interceptor for jaxrs,but
> the method is not invoked.
>
> Thanks,
> Vishal
>
>
>
> Gabo Manuel wrote:
>   
>> Hi Vishal,
>>
>> In what way does the call to the second method fail? Does it get 
>> invoked? Are the parameters empty or null? Was the post request properly 
>> structured (you can check using tcpmon or some similar tool)?
>>
>> Gabo
>>
>> Vishal.a wrote:
>>     
>>> Hello All,
>>>
>>> I am trying to haave multiple POST methods something like this
>>>
>>> @POST
>>> @Path("/groups")
>>> public Summary insertGroup(Group group)
>>>
>>> and
>>>
>>> @POST
>>> @Path("/groups/{id}/users")
>>> public void addUsersToGroup(@PathParam("id")UUID groupId,
>>>                                 ListWrapper<UUID> userIds)
>>>
>>> The POST call to first method works absolutely fine,however call to the
>>> addUsersToGroup method fails.
>>> What could i be doing wrong?
>>>
>>> Thanks,
>>> Vishal
>>>   
>>> ------------------------------------------------------------------------
>>>
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG - www.avg.com 
>>> Version: 8.0.238 / Virus Database: 270.11.58/2061 - Release Date:
>>> 04/15/09 19:52:00
>>>
>>>   
>>>       
>>     
>
>   
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.0.238 / Virus Database: 270.11.59/2063 - Release Date: 04/16/09 16:38:00
>
>   

Re: JAXRS: Problems with POST

Posted by "Vishal.a" <vi...@gmail.com>.
Hello Gabo,

Here is the output from tcpmon

POST /rest/peopleservice/groups/014773b8-b3a6-4c92-95be-97b760ff20d2/users
HTTP/1.1
Content-Length: 424
Content-Type: application/xml; charset=UTF-8
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.0-beta2 (java 1.5)
Expect: 100-Continue

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
   <listWrapper>
      <_data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xsi:type="xs:string">2a849ceb-205a-4bdf-921b-f215b78642bf</_data>
      <_data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xsi:type="xs:string">c3ae8ba3-1ea2-4ef6-a813-c7656a6334f1</_data>
   </listWrapper>

I can see the request going in from the logging interceptor for jaxrs,but
the method is not invoked.

Thanks,
Vishal



Gabo Manuel wrote:
> 
> Hi Vishal,
> 
> In what way does the call to the second method fail? Does it get 
> invoked? Are the parameters empty or null? Was the post request properly 
> structured (you can check using tcpmon or some similar tool)?
> 
> Gabo
> 
> Vishal.a wrote:
>> Hello All,
>>
>> I am trying to haave multiple POST methods something like this
>>
>> @POST
>> @Path("/groups")
>> public Summary insertGroup(Group group)
>>
>> and
>>
>> @POST
>> @Path("/groups/{id}/users")
>> public void addUsersToGroup(@PathParam("id")UUID groupId,
>>                                 ListWrapper<UUID> userIds)
>>
>> The POST call to first method works absolutely fine,however call to the
>> addUsersToGroup method fails.
>> What could i be doing wrong?
>>
>> Thanks,
>> Vishal
>>   
>> ------------------------------------------------------------------------
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com 
>> Version: 8.0.238 / Virus Database: 270.11.58/2061 - Release Date:
>> 04/15/09 19:52:00
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/JAXRS%3A-Problems-with-POST-tp23090556p23091264.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: JAXRS: Problems with POST

Posted by Gabo Manuel <km...@solegysystems.com>.
Hi Vishal,

In what way does the call to the second method fail? Does it get 
invoked? Are the parameters empty or null? Was the post request properly 
structured (you can check using tcpmon or some similar tool)?

Gabo

Vishal.a wrote:
> Hello All,
>
> I am trying to haave multiple POST methods something like this
>
> @POST
> @Path("/groups")
> public Summary insertGroup(Group group)
>
> and
>
> @POST
> @Path("/groups/{id}/users")
> public void addUsersToGroup(@PathParam("id")UUID groupId,
>                                 ListWrapper<UUID> userIds)
>
> The POST call to first method works absolutely fine,however call to the
> addUsersToGroup method fails.
> What could i be doing wrong?
>
> Thanks,
> Vishal
>   
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.0.238 / Virus Database: 270.11.58/2061 - Release Date: 04/15/09 19:52:00
>
>