dev@jersey.java.net

jersey-json _at_Consume POST

From: Gallagher,Patrick <Patrick.Gallagher_at_Cerner.com>
Date: Thu, 22 Oct 2009 15:08:56 -0500

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 <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.