1
我开发了一个Gwt应用程序,现在需要从另一个Java应用程序调用其远程服务实现 。是否有给定的Java对象的列表可以改变它们的格式适用于当调用get服务的servlet的方法是这样的:?如何从外部应用程序调用GwtServiceImpl Servlet?
myObject = .......
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost postRequest = new HttpPost(
"http://localhost:8080/ppp//org.yournamehere.Main/gwtservice");
String serialized = <somelibrary.serialize>(myObject);
StringEntity input = new StringEntity(serialize);
input.setContentType("text/x-gwt-rpc; charset=UTF-8");
postRequest.setEntity(input);
HttpResponse response = httpClient.execute(postRequest);
更多的浏览后,我发现这里的解决方案:http://code.google.com/p/gwt-syncproxy/ – marinosegnan 2012-03-21 09:51:34
是,syncproxy更容易建立(虽然我没有试过另一个建议)。然而,我却遇到了烦人的关于不可序列化的类型(通常是基元数组)的错误消息,尽管它们是gwt.rpc白名单,但它们并不在gwt.rpc白名单中。 – 2012-03-21 18:46:04