My favorites | Sign in
Project Logo
                
Search
for
Updated Dec 03, 2007 by piotr.dobrowolski
Labels: Featured, Phase-Deploy
Readme  
Quick startup guide

Introduction

Here's a short introduction how to use gwt-hermes.

Details

1. download gwt-hermes.jar

2. add Hermes to your module file add a section that will look like this:

<inherits name="com.overto.gwt.hermes.Hermes" />

3. declare an interface of JSON service you want to call Exactly like in case of GWT RPC you have to define an interface of your service, i.e.:

public interface TestService extends RemoteJSONService {
  public int testMethod(String param);
}

PLEASE NOTE:

classes have to expose properties by public getters and setters

4. declare an async interface for your service Again exactly the same as in GWT RPC:

public interface TestServiceAsync {
  public void testMethod(String param, AsyncCallback callback);
}

PLEASE NOTE:

5. use GWT.create to create async version of your interface

TestServiceAsync testService = (TestServiceAsync) GWT.create(TestService.class);

6. use JSONServiceDefTarget to configure service address Once again - exactly like in GET RPC:

JSONServiceDefTarget serviceTarget = (JSONServiceDefTarget) testService;	
serviceTarget.setServiceEntryPoint("http://foo.com/json");
serviceTarget.setAppendMethodNameToAddress(false);

PLEASE NOTE:

7. call your service Exactly the same syntax as in GWT here:

testService.testMethod("a", new new AsyncCallback() {

				public void onFailure(Throwable caught) {
					Window.alert(caught.toString());
					
				}

				public void onSuccess(Object result) {
					Window.alert(result.toString());
				}
				
			});

The result can be cast to the result type of the method.

Enjoy!


Comment by batl...@lovelysystems.com, Sep 02, 2008

seems like there is a typo:

testService.testMethod("a", new new AsyncCallback?() {

should be:

testService.testMethod("a", new AsyncCallback?() {


Sign in to add a comment
Hosted by Google Code