Content-Type error

52 views
Skip to first unread message

linhares

unread,
Nov 4, 2010, 5:10:20 PM11/4/10
to gwtrpccommlayer
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);

Dan Billings

unread,
Nov 5, 2010, 12:05:47 PM11/5/10
to gwtrpccommlayer
Did you extend GwtRpcServiceServlet or did you use an init-param on
it?

Ivan Linhares Martins

unread,
Nov 5, 2010, 12:48:55 PM11/5/10
to gwtrpcc...@googlegroups.com
Yes, I forgot to extend the GwtRpcServiceServlet, its works like a
charm now! thanks

-- Ivan

--
Esta mensagem (incluindo arquivos anexos) contém informações
confidenciais, privilegiadas ou protegidas por lei. Ela é dirigida
exclusivamente ao seu destinatário que a empregará nos ditames legais.
Se você não é o destinatário desta mensagem, deve imediatamente
destruí-la e advertir o remetente do erro de envio e a destruição da
mensagem. Qualquer divulgação, utilização, disseminação ou reprodução
(total ou parcial) desta mensagem ou das informações nela contidas é
proibida e sujeitará as sanções criminais a que incorrer, sem prejuízo
de perdas e danos.

Reply all
Reply to author
Forward
0 new messages