Thanks, i'll take a look at that, jersey is a good plugin, makes my job
much easier:D
edit : problem solved and i get better view on web service
On Tue, Nov 1, 2011 at 7:41 PM, japod [via Jersey] <
ml-node+s576304n6951523h77_at_n2.nabble.com> wrote:
> Hi,
>
> i presume you want to exchange XML entities. Then you need
> to annotate your resource methods with
> @Produces("application/xml") and/or @Consumes("application/xml")
> according to what your resource method does (producing and/or consuming
> JAXB beans).
>
> You also need to make sure appropriate HTTP headers are used on the
> client side,
> namely Content-type and also Accept header should be used there to
> determine
> the media type for the entities.
>
> A complete example (including tests with client side code) could be
> downloaded from [1].
>
> HTH,
>
> ~Jakub
>
> [1]
> http://search.maven.org/remotecontent?filepath=com/sun/jersey/samples/jaxb/1.10-b05/jaxb-1.10-b05-project.zip
>
>
> On 24.10.2011 6:07, tyo07 wrote:
>
> > Hello, i'm trying to consume web service using jersey. Server was made
> from
> > spring and it's REST based. When using java restclient i'm able to
> retrieve
> > data from the temporary database that i added manually. But when i'm
> using
> > Junit to test whether the server can response my request or not, "The
> > registered message body readers compatible with the MIME media type are"
> are
> > showed up.
> >
> > Details : A message body reader for Java class
> > com.hascode.tutorial.rest.bean.CustomerBean, and Java type class
> > com.hascode.tutorial.rest.bean.CustomerBean, and MIME media type
> > application/octet-stream was not found.
> >
> > file customerbean itself was like this.
> >
> > [CODE]
> > package com.hascode.tutorial.rest.bean;
> >
> > import javax.ws.rs.*;
> >
> > import javax.xml.bind.annotation.XmlAttribute;
> > import javax.xml.bind.annotation.XmlElement;
> > import javax.xml.bind.annotation.XmlRootElement;
> >
> > @XmlRootElement(name = "customer")
> > @Consumes({"application/xml", "application/json"})
> >
> > public class CustomerBean {
> > private Long id;
> > private String firstName;
> > private String lastName;
> > private Double money;
> >
> > @XmlAttribute
> >
> > public Long getId() {
> > return id;
> > }
> > public void setId(Long id) {
> > this.id = id;
> > }
> > public String getfirstName() {
> > return firstName;
> > }
> > public void setfirstName(String firstName) {
> > this.firstName = firstName;
> > }
> >
> > @XmlElement(name = "customer_lastName")
> > public String getlastName() {
> > return lastName;
> > }
> > public void setlastName(String lastName) {
> > this.lastName = lastName;
> > }
> > public Double getmoney() {
> > return money;
> > }
> > public void setmoney(Double money) {
> > this.money = money;
> > }
> > }[/CODE]
> >
> > I might be wrong at using @Consumes/_at_Produces, but where should i set
> that
> > type so "application octet stream" error not showed up?
> >
> > Sorry for bad english:D
> >
> > --
> > View this message in context:
> http://jersey.576304.n2.nabble.com/The-registered-message-body-readers-compatible-with-the-MIME-media-type-are-tp6923901p6923901.html
> > Sent from the Jersey mailing list archive at Nabble.com.
> >
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://jersey.576304.n2.nabble.com/The-registered-message-body-readers-compatible-with-the-MIME-media-type-are-tp6923901p6951523.html
> To unsubscribe from The registered message body readers compatible with
> the MIME media type are, click here<http://jersey.576304.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=6923901&code=ZW1haWwudHlvQGdtYWlsLmNvbXw2OTIzOTAxfDExNjkyMDM4OTE=>.
>
>
--
Don't give up, Never give up
- Blood Legion -
--
View this message in context: http://jersey.576304.n2.nabble.com/The-registered-message-body-readers-compatible-with-the-MIME-media-type-are-tp6923901p6951994.html
Sent from the Jersey mailing list archive at Nabble.com.