I have a problem to post (or put) xml in newer restlet releases after 2.0-RC4
I tried a lot but found no solution, so where is my misunderstanding?
I have the following resource interface:
public interface IPostResource {
/**
* @param xml XML-coded method parameter
* @return whatever method wants to return
*/
@Post(value = "xml")
String processXml(String xml);
}
on the client side, I try the following:
MemberDto memberDto = new MemberDto();
memberDto.setFirstName("Duffy");
memberDto.setLastName("Duck");
XStream xs = new XStream();
String registration = xs.toXML(memberDto);
String resp = register.processXml(registration);
with restlet 2.0-m7 on the client side, this works fine
with newer versions (actually using 2.0.7) it will raise
Exception in thread "main" Method Not Allowed (405) - Method Not Allowed
at
org.restlet.resource.ClientResource$1.invoke(ClientResource.java:1652)
at $Proxy7.processXml(Unknown Source)
when looking at the HTTP headers, I see
content-type: text/plain; charset=UTF-8
which is rejected by the server
switching back to restlet 2.0-RC4 everything works fine
in this case, restlet sends
content-type: */*; charset=UTF-8
which is accordingly passed to my IPostResource implementation
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2754355