請裸露在我身邊。 這是我在谷歌應用程序引擎:)從C#客戶端到基於Java的Google App Engine的RPC到
我有很多的調用從C#客戶
這是我的客戶端代碼看起來像一個基於Java的谷歌應用程序引擎服務器的問題第一次去:
// C# Client
static void Main(string[] args)
{
const string URL = "http://localhost:8888/googlewebapptest7/greet";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.Method = "POST";
request.ContentType = "text/x-gwt-rpc; charset=utf-8";
string content = "<?xml version='1.0'?><methodCall><methodName>greetServlet.GetName</methodName><params></params></methodCall>";
byte[] contentBytes = UTF8Encoding.UTF8.GetBytes(content);
request.ContentLength = contentBytes.Length;
using (Stream stream = request.GetRequestStream())
{
stream.Write(contentBytes, 0, contentBytes.Length);
}
// get response
WebResponse response = request.GetResponse();
using (Stream responseStream = response.GetResponseStream())
{
string res = new StreamReader(responseStream).ReadToEnd();
Console.WriteLine("response from server:");
Console.WriteLine(res);
Console.ReadKey();
}
服務器基本上是有一個額外的方法谷歌默認的Web項目:
public String GetName() { return "HI!"; }
添加到GreetingServiceImpl。
每次我跑我的客戶,我從服務器獲取以下異常: An IncompatibleRemoteServiceException was thrown while processing this call. com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: This application is out of date, please click the refresh button on your browser. (Malformed or old RPC message received - expecting version 5)
我想保持它在普通的HTTP請求。
任何想法是怎麼回事? -任何幫助將非常感激!
它看起來像你試圖模仿GWT的RPC格式。你基於什麼?是什麼讓你認爲這個特殊的URL會接受這種特殊類型的RPC調用? – 2010-06-23 10:08:50
我已覆蓋 protected java.lang.String readContent(javax.servlet.http.HttpServletRequest request) 並可以看到來電。我認爲XML-RPC請求應該足夠了,但是當我單步執行代碼時,看起來請求應該以類似5 |?|?|?|在哪裏?應該是整數。我還沒有調查整數意味着什麼 你有想法更好的方法嗎? – EsbenB 2010-06-23 11:14:48