users@jersey.java.net

Re: [Jersey] Re: consuming xml

From: Pavel Bucek <Pavel.Bucek_at_Sun.COM>
Date: Mon, 08 Mar 2010 11:14:42 +0100

1) xml string you are sending is wrong - try following:


<object>
                <name>TestFolder</name>
                <type>dm_folder</type>
                <path>/Temp</path>
</object>

(this solves your null values issue; my xml is simplified because you
didn't send SysObjectRequestProperty class)


2) don't add xsi:noNamespaceSchemaLocation. I'm not sure why but it
somehow prevents xml to be parsed correctly (HTTP/1.1 400 Bad Request is
returned).


hope it helps

Pavel


emile wrote:
> Hi Pavel,
>
> Thanks for the response. This is what my resource class looks like-
>
> @Path("/repositories/{repositoryName}/folders")
> public class FoldersResource {
>
> @POST
> @Consumes(MediaType.APPLICATION_XML)
> @Produces(MediaType.APPLICATION_XML)
> public String getObjectAsXML(@PathParam("repositoryName") String
> strRepositoryName, SysObjectRequestObject sysObj)
> {
> //object processing
> }
> }
>
> I'm sending an XML using curl:- curl -X POST -HContent-type:application/xml
> --data @test1.xml http://loc
> alhost:8081/jersey/rest/repositories/DOC/folders.xml
>
> I have attached the test1.xml file and the SysObjectRequestObject java
> class. http://n2.nabble.com/file/n4694094/test1.xml test1.xml
> http://n2.nabble.com/file/n4694094/SysObjectRequestObject.java
> SysObjectRequestObject.java
>
>
>
>
>
>