Hi, I have GWT + Restlet + Java code. When I return string from backend code through restlet based REST api, it works in GWT. But when I try to get java object (like Contact resource in restlet example), I get following error "Can't parse the enclosed entity" on GWT client side while receiving the response:
INFO: 2011-01-03 22:13:46 127.0.0.1 - 127.0.0.1 8888 GET /rest/entity - 200 - 0 2969 http://127.0.0.1:8888 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10 http://127.0.0.1:8888/sname.html?gwt.codesvr=127.0.0.1:9997 java.io.IOException: Can't parse the enclosed entity at com.sname.client.EntityResourceProxyProxy$1.handle(EntityResourceProxyProxy.java:47) at org.restlet.client.engine.http.adapter.ClientAdapter$1.handle(ClientAdapter.java:95) at org.restlet.client.engine.http.GwtClientCall$2.onResponseReceived(GwtClientCall.java:245) at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287) at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.google.gwt.core.client.impl.Impl.apply(Impl.java) at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214) at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352) at java.lang.Thread.run(Unknown Source) Any idea why is this? Setup: GWT 2.1.1, Restlet 2.0.4 Here are code snippets. Am I missing something in my code? public class Sname implements Serializable { private String fname; private String lname; //private int zip; public String getFname() { return fname; } public void setFname(String fname) { this.fname = fname; } public String getLname() { return lname; } public void setLname(String lname) { this.lname = lname; } } public interface EntityResource { @Get public Sname getTopicList(); } public interface EntityResourceProxy extends ClientProxy { @Get public void getTopicList(Result<Sname> callback); } public class EntityServerResource extends ServerResource implements EntityResource { @Get public Sname getTopicList() { Sname tlist = new Sname(); tlist.setFname("Ninad"); tlist.setLname("Ghodke"); return tlist; } } private void testCode() { // Set up the contact resource entityResource.getClientResource().setReference("/rest/entity"); entityResource.getClientResource().getClientInfo().getAcceptedMediaTypes().add(new Preference<MediaType>(MediaType.APPLICATION_JAVA_OBJECT_GWT)); // Retrieve the contact entityResource.getTopicList(new Result<Sname>() { public void onFailure(Throwable caught) { // Handle the error Window.alert("ERROR" + caught.getMessage()); caught.printStackTrace(); } public void onSuccess(Sname jlist) { Window.alert(jlist.toString()); } } -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/GWT-Restlet-Error-java-io-IOException-Can-t-parse-the-enclosed-entity-tp5887760p5887760.html Sent from the Restlet Discuss mailing list archive at Nabble.com. ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2695785

