I have a simple RPC call that works fine when it is calling into the local server
ContactsServiceAsync rpcService = GWT.create(ContactsService.class);
rpcService.getContactDetails(new AsyncCallback<ArrayList<ContactDetails>>() {
public void onSuccess(ArrayList<ContactDetails> result) {
Window.alert("Successfully called server");
}
public void onFailure(Throwable caught) {
Window.alert("Error calling server");
}
});
What I now want to do is change the endpoint to call a service on GAE ( I just deployed the same GWT app on GAE so the service name should remain unchanged )
ContactsServiceAsync rpcService = GWT.create(ContactsService.class);
ServiceDefTarget target = (ServiceDefTarget) rpcService;
target.setServiceEntryPoint("http://myquizapp2.appspot.com/");
rpcService.getContactDetails(new AsyncCallback<ArrayList<ContactDetails>>() {
public void onSuccess(ArrayList<ContactDetails> result) {
Window.alert("Successfully called server");
}
public void onFailure(Throwable caught) {
Window.alert("Error calling server");
}
});
Note the “attempt” I made to change the end point the client will use to call the service. It does not work and my onFailure method gets called. Am I attempting to do something that does not make any sense or can it be done at all?
You should take a look at how to achieve cross domain GWT RPC. You can start of with some example here http://java.dzone.com/articles/how-do-cross-domain-gwt-rpc