users@jersey.java.net

[Jersey] Re: Rest Post Unsupported Media Type

From: peterwkc <peterapiit_at_gmail.com>
Date: Tue, 5 Jul 2011 02:37:36 -0700 (PDT)

At this moment, let focus on question 1 first and will proceed to question 2
after i have solved the question 1.

1. I have tested the function using the jersey client api and i found out
that is the parameter problem in the

@POST
@Consumes(MediaType.APPLICATION_XML)
public Response createOrder(Custorder myCustOrder, @Context UriInfo
myUriInfo) {}

When i removed the myCustOrder parameter, everything works fine but jersey
runtime return bad request with the Custorder parameter.

The Custorder POJO is like this :

@Entity
@Table(name = "CUSTORDER", catalog = "", schema = "PETERWKC")
@XmlRootElement
public class Custorder implements Serializable {} and has @XMLElement for
every attributes.


I tested the createOrder function like this :

result = resource.type(MediaType.APPLICATION_XML)
            .accept(MediaType.APPLICATION_XML)
            .entity(new File(entity))
            .post(String.class);
System.out.println("Result : " + result);

What wrong or problem with it ?

Please help.

Thanks.


--
View this message in context: http://jersey.576304.n2.nabble.com/Rest-Post-Unsupported-Media-Type-tp6499271p6549038.html
Sent from the Jersey mailing list archive at Nabble.com.