Quantcast

jersey-json @Consume POST

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

jersey-json @Consume POST

Patrick G.

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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: jersey-json @Consume POST

Paul Sandoz
Administrator
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+<a href="mid:drm55y2xwfdpbpx2+state:results">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.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: jersey-json @Consume POST

Patrick G.

Thanks Paul.  Sorry for double posting this.  I thought I had hit the wrong list the first time.

 

Patrick Gallagher | Software Engineer | Cerner Corporation | Office: 816.201.1587 | Fax: 816.571.1587 | [hidden email] | www.cerner.com

 

From: [hidden email] [mailto:[hidden email]]
Sent: Friday, October 23, 2009 9:40 AM
To: [hidden email]
Cc: Gallagher,Patrick
Subject: Re: [Jersey] jersey-json @Consume POST

 

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+<a href="mid:drm55y2xwfdpbpx2+state:results">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.

 

Loading...