Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoke a GWT RPC service from Java directly

Tags:

java

gwt

gwt-rpc

Is there an easy way to invoke a GWT RPC service endpoint directly from Java code? I mean real Java code, not Java code compiled down into javascript.

I ask because we want to run performance benchmarks/stress tests against a GWT RPC interface. I would like to write the test harness in Java and run it in a JVM (as opposed to javascript running in a browser).

I figure there must be a way to do this because I assume GWT Hosted mode requires such functionality. However, I can't really find any code in the GWT runtime that demonstrates how to cleanly do this. I've looked at the com.google.gwt.user.client.rpc package but the stuff in there seems to use JSNI which obviously wouldn't be usable by pure Java.

like image 942
Eric Avatar asked Aug 25 '09 19:08

Eric


People also ask

What is RPC in GWT?

RPC, Remote Procedure Call is the mechansim used by GWT in which client code can directly executes the server side methods. GWT RPC is servlet based. GWT RPC is asynchronous and client is never blocked during communication.

Is GWT server-side?

Server-side CodeGWT provides an RPC mechanism based on Java Servlets to provide access to server-side resources. This mechanism includes generation of efficient client-side and server-side code to serialize objects across the network using deferred binding.

What is GWT servlet?

The gwt-servlet library supports the server-side components for invoking a GWT-RPC endpoint. gwt-user contains the Java API which we'll use to build our web application. gwt-dev has the code for compiler, deployment or hosting the application.

What is GWT API?

The GWT includes a class library designed to help you build your user interface, make RPC calls to your server, internationalize your application, perform unit testing, and lots more. For complete details about the GWT class library, click below to view the javadoc-style API reference.


1 Answers

GWT SyncProxy allows you to access GWT RPC services (e.g methods) from pure Java (not JSNI) code. Thus you can use it to test your RPC interface.

See http://www.gdevelop.com/w/blog/2010/01/10/testing-gwt-rpc-services/ for details.

like image 59
Trung Avatar answered Oct 07 '22 01:10

Trung