Take all of the logic out of your RPC servlet and put it in another class. Call that class' methods from your RPC servlet's service method implementations. Write another interface, such as a plain servlet, and have it call the logic class methods, too. In the Java desktop, call the non-RPC interface (e.g. via HttpConnection).
On Fri, Sep 18, 2009 at 8:26 AM, wesley.imamura <[email protected]> wrote: > > Hi, > > I'm new to GWT. > I'd like to call an existing GWT RPC Servlet running on JBoss from a > simple java standalone main class( instead of using a web interface/ > ajax). > > From the error below, I suppose the api is not for that purpose. > > Can someone help ? > > > SIMPLE JAVA CODE: > > public class GuvnorClient { > > public static void main(String[] args) { > GuvnorClient c = new GuvnorClient(); > c.test(); > } > public void test() { > > SecurityServiceAsync securityService = (SecurityServiceAsync) > GWT.create(SecurityService.class); > ((ServiceDefTarget) securityService).setServiceEntryPoint("http:// > localhost:8080/org.drools.guvnor.Guvnor/securityService"); > > securityService.login("admin","admin",new AsyncCallback() { > public void onFailure(Throwable caught) {} > public void onSuccess(Object result) {} > }); > } > } > > ERROR: > > Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create > () is only usable in client code! It cannot be called, for example, > from server code. If you are running a unit test, check that your > test case extends GWTTestCase and that GWT.create() is not called from > within an initializer or constructor. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
