我正在尝试让一个 RPC 调用与 phonegap 一起使用。我正在按照http://blog.daniel-kurka.de/2012/04/gwt-rpc-with-phonegap-revisited.html上的说明进行操作
PhonegapUtil.prepareService(service, "http://www.yourserver.com/", "greet");
当我查看此方法的实现时,我可以看到该服务必须是 PhonegapRPCService 类型,否则会引发错误。该实现具有以下代码
if (!(service instanceof PhonegapRPCService)) {
throw new IllegalStateException("the rpc service you are trying to use was not generated by Phonegap RPC Serivce Generator");
到目前为止,这是我的代码
ContactsServiceAsync rpcService = GWT.create(ContactsService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) rpcService;
PhonegapUtil.prepareService(endpoint, "https://myquizapp2.appspot.com/", "contactsService");
HandlerManager eventBus = new HandlerManager(null);
AppController appViewer = new AppController(rpcService, eventBus);
appViewer.go(RootPanel.get());
问题是我看不到如何创建一个PhonegapRPCService 实例,该实例将调用我服务器上的contactsService 服务。关于如何使用它的任何想法?