HI, i´m trying to use the client with a GWT 2.0.4 servlet but i
´getting the following error. Any guess on how to fix it?
SEVERE: [1288904172501000] javax.servlet.ServletContext log: Exception
while dispatching incoming RPC call
javax.servlet.ServletException: Content-Type was 'binary/octet-
stream'. Expected 'text/x-gwt-rpc'.
at
com.google.gwt.user.server.rpc.RPCServletUtils.checkContentType(RPCServletUtils.java:
366)
at
com.google.gwt.user.server.rpc.RPCServletUtils.readContentAsUtf8(RPCServletUtils.java:
172)
at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.readContent(AbstractRemoteServiceServlet.java:
179)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:
215)
at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:
62)
My code is:
//STEP 1: create the URL that points to your service/servlet
URL url = new URL("
http://127.0.0.1:8888/wattlas/appService");
//STEP 2: create an instance of GwtRpcCommLayerClient
GwtRpcCommLayerClient client = new GwtRpcCommLayerClient(url);
//STEP 3: ask the client for a reference to the client-side proxy of
your remote service
AppService stub =
(AppService)
client.createRemoteServicePojoProxy(AppService.class);
//STEP 4: any call you execute against this proxy will ultimately
execute on your servlet
stub.save(sb.toString(), 0);