users@jersey.java.net

[Jersey] The registered message body readers compatible with the MIME media type are

From: tyo07 <email.tyo_at_gmail.com>
Date: Sun, 23 Oct 2011 21:07:09 -0700 (PDT)

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.