-
Bug
-
Resolution: Done
-
Major
-
1.0.2.GA
-
None
-
None
orry for the terrible subject and the second post, seems my first one did not take...
This seems like such an obvious issue that I am surprised I have not found it in jira. As soon as I start to subclass my interfaces as in the following example the client chokes a bit unexpectedly.
Environment = RestEasy 1.0.2.GA, OS X, java 1.5
Webservice base url = http://localhost:8080/ws
=================================================
ClientTest.java
=================================================
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations=
)
public class ClientTest {
@Resource
private ServiceLocation serviceLocation;
@Test
public void testBasic()
}
=================================================
UserEntity.java
=================================================
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name="user")
public class UserEntity {
@XmlElement
private String username;
public UserEntity()
{ super(); }public String getUsername()
{ return username; }public void setUsername(String username)
{ this.username = username; }}
=================================================
UserEntityWebservice.java
=================================================
@Path("/user")
@Produces(
@Consumes({"application/xml","application/json"}
)
public interface UserEntityWebservice extends CRUDEntityWebservice {
}
=================================================
CRUDEntityWebservice.java
=================================================
public interface CRUDEntityWebservice {
@POST
@Path("/")
public UserEntity create( UserEntity entity );
}
If I run this as is I get:
java.lang.RuntimeException: You must define a @ConsumeMime type on your client method or interface
at org.jboss.resteasy.client.core.ClientMarshallerFactory.createMarshaller(ClientMarshallerFactory.java:104)
If I add the annotation to the CRUDEntityWebservice as this:
@Produces(
{"application/xml","application/json"})@Consumes({"application/xml","application/json"}
)
public interface CRUDEntityWebservice {
@POST
@Path("/")
public UserEntity create( UserEntity entity );
}
I get a 404 error and the log shows that it's not getting the correct path built.
[DEBUG] wire.header >> "POST /paymentobjects-webservices/ws/ HTTP/1.1[\r][\n]"
org.jboss.resteasy.client.ClientResponseFailure: Error status 404 Not Found returned
Finally if I add a add a Path to the CRUD interface it all works fine:
@Path("/usr")
@Produces(
@Consumes({"application/xml","application/json"}
)
public interface CRUDEntityWebservice {
@POST
@Path("/")
public UserEntity create( UserEntity entity );
}
This seems like such an obvious use case that I am quite surprised that I am running into it. If this is the way things are supposed then I would have to flatten out my Webservice interfaces to make this work which just sounds silly. Is there something that I am doing wrong?