users@jersey.java.net

Re: [Jersey] passing in JSON to create a resource

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 31 Jul 2009 10:27:18 +0200

On Jul 31, 2009, at 4:14 AM, Jesus M. Rodriguez wrote:

> Thanks for everyone's help. It was a bad case of PEBKAC. I tested it
> with the json-from-jaxb samples and the post
> was working fine. i then opened up wireshark and noticed that the
> junit test was sending json, while my python
> client was sending urlencoded values :) clearly NOT json.
>
> After I switched it to a string, it worked great. I've not added
> simplejson to my python client and things are
> working great.
>

Glad you got things working.

Obviously the error could be improved here. The lexer code is
generated, and thus so is the error, but the Jersey/JSON layer could
hint to what is wrong based on this error.

Paul.

> Thanks again for the support.
>
> jesus
>
> On Thu, Jul 30, 2009 at 12:34 PM, Kevin Duffey<andjarnic_at_yahoo.com>
> wrote:
>> Did you make sure your request has the proper method and content-type
>> headers to match the POST and application/xml your method is
>> looking for?
>>
>> ________________________________
>> From: Jesus M. Rodriguez <jmrodri_at_nc.rr.com>
>> To: users_at_jersey.dev.java.net
>> Sent: Thursday, July 30, 2009 5:45:35 AM
>> Subject: Re: [Jersey] passing in JSON to create a resource
>>
>> Kevin,
>>
>> On Thu, Jul 30, 2009 at 1:33 AM, Kevin Duffey<andjarnic_at_yahoo.com>
>> wrote:
>>> Jesus,
>>>
>>> Take a look at using Jersey with JAXB. It allows you to easily
>>> handle json
>>> and xml being turned into your domain object and vice versa.
>>
>> I've got JAXB generating JSON in Jersey for returned objects quite
>> nicely.
>> But when I have my client POST json to the resource, I get a
>> 'java.lang.Error: Error: could not match input' error.
>>
>> http://pastie.org/565210
>>
>> So it's saying it doesn't know how to transform my JSON into the
>> specified
>> object. And I can't find documentation that can clue me into what I'm
>> doing wrong.
>>
>> jesus
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>