更改终结点时GWT RPC调用不起作用

更改终结点时GWT RPC调用不起作用,gwt,rpc,Gwt,Rpc,我有一个简单的RPC调用,它在调用本地服务器时可以正常工作 ContactsServiceAsync rpcService = GWT.create(ContactsService.class); rpcService.getContactDetails(new AsyncCallback<ArrayList<ContactDetails>>() { public void onSuccess(ArrayList<Contact

我有一个简单的RPC调用,它在调用本地服务器时可以正常工作

      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");
      }
    });
ContactsService异步rpcsservice=GWT.create(ContactsService.class);
getContactDetails(新的AsyncCallback(){
成功时公共无效(ArrayList结果){
警告(“成功调用服务器”);
}
失败时的公共无效(可丢弃){
Window.alert(“调用服务器时出错”);
}
});
我现在想做的是更改端点以调用GAE上的服务(我刚刚在GAE上部署了相同的GWT应用程序,因此服务名称应该保持不变)

ContactsService异步rpcsservice=GWT.create(ContactsService.class);
ServiceDefTarget=(ServiceDefTarget)rpcService;
target.setServiceEntryPoint(“http://myquizapp2.appspot.com/");
getContactDetails(新的AsyncCallback(){
成功时公共无效(ArrayList结果){
警告(“成功调用服务器”);
}
失败时的公共无效(可丢弃){
Window.alert(“调用服务器时出错”);
}
});

请注意,我试图更改客户端用于调用服务的端点。它不工作,并且调用了我的onFailure方法。我是在尝试做一些毫无意义的事情,还是完全可以做到?

您应该看看如何实现跨域GWT RPC。您可以从这里的一些示例开始

您遇到了跨域rpc问题。
  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");
      }
    });