users@jersey.java.net

Re: [Jersey] jersey-json _at_Consume POST

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 23 Oct 2009 16:40:13 +0200

Hi Patrick,

Jakub replied to the same email you sent to the dev list, see here:

http://markmail.org/search/?q=list%3Anet.java.dev.jersey.dev#query:list
%3Anet.java.dev.jersey.dev+page:1+mid:drm55y2xwfdpbpx2+state:results

Paul.

On Oct 23, 2009, at 4:33 PM, Gallagher,Patrick wrote:

> Hello,
>
> I am having trouble using my Jaxb Object in a POST that consumes an
> application/json request. The Jaxb object is generated using the
> maven2-jaxb-plugin from a .XSD file. I am able to complete this
> operation using standard XML and even able to generate a response
> from a GET in JSON format but I am not able to POST JSON data to the
> service. I received “The request sent by the client was
> syntactically incorrect” when posting the following to the service:
>
> {"name
> ":"junittest7
> ","version
> ":"1.0","release_ind":"true","repository_id":"0","repository_path":"/
> test
> ","group_id
> ":"264
> ","scmr_id":"0","scmr_path":"test","team_number":"1","sub_type":"JAR"}
>
> This string is the same string that results from a GET on a simple
> service call for the object. Can you give any hints as to why this
> syntax is not parsed correctly by the JSON Marshaller in the jersey-
> json add-on? As I step through the code, I get a marshaller error
> just after the JSON token for the first “:” character but cannot
> really tell why.
>
> Here is the XSD that generate the Jaxb Object:
>
> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema
> elementFormDefault="qualified" …>
> <xs:element name="create_artifact_request">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="name" type="xs:string">
> <xs:element name="version" type="xs:string" />
> <xs:element name="release_ind" type="xs:boolean" />
> <xs:element name="repository_id" type="xs:int" />
> <xs:element name="repository_path" type="xs:string" />
> <xs:element name="group_id" type="xs:int" />
> <xs:element name="scmr_id" type="xs:int />
> <xs:element name="scmr_revision" type="xs:string"
> minOccurs="0 /">
> <xs:element name="scmr_path" type="xs:string"
> minOccurs="0" />
> <xs:element name="team_number" type="xs:int" />
> <xs:element name="sub_type" type="xs:string" />
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
>
>
> Thanks for any guidance you can provide.
>
> CONFIDENTIALITY NOTICE This message and any included attachments are
> from Cerner Corporation and are intended only for the addressee. The
> information contained in this message is confidential and may
> constitute inside or non-public information under international,
> federal, or state securities laws. Unauthorized forwarding,
> printing, copying, distribution, or use of such information is
> strictly prohibited and may be unlawful. If you are not the
> addressee, please promptly delete this message and notify the sender
> of the delivery error by e-mail or you may call Cerner's corporate
> offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.