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