views:

47

answers:

1

Hi All,

Please bare with me. This is my first go on the Google app Engine:)

I'm having a lot of problems calling a Java based Google App Engine server from a C# client

This is how my client code looks like:

 // 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();
  }     

The server is basically the Google default web project with an additional method:

public String GetName() { return "HI!"; }

added to GreetingServiceImpl.

Everytime I run my client, I get the following exception from the server: 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 )

I would like to keep it in plain HTTP requests.

Any idea what's going on? -Any help would be much appreciated!

A: 

I never found a good way to use XML based RPC on the Google App Engine. Instead i found this excellent JSON library with tutorial:

http://werxltd.com/wp/portfolio/json-rpc/simple-java-json-rpc/

it works very well!

Cipramill