Search This Blog

Loading...

Sunday, May 2, 2010

How to Use C# Client to Consume Google App Engine's rpc

Google App Engine allows one to run the web apps on Google infrastructure. This is especially enticing to developers because it takes care of hardware, hosting,  scaling, authentication and deployment issues.

I'm glad to learn that one can create desktop clients in any language to take to the Google App Engine backend. The way this can be done is as thus. First, get the excellent xml rpc python code from here, integrate it into your Google App Engine application.

The meat of your web service method is defined inside the application class, assuming that we have the following method in the application class:
def getName(self,meta, keyInput):                                                    
    return keyInput


This is how you can call this service method from C# client, by making use of the xml-rpc.net library:

[XmlRpcUrl("http://localhost:8080/xmlrpc")]
public interface AppTest: IXmlRpcProxy
{
    [XmlRpcMethod("app.getName")]
    string GetName(string number);

}

public string GetName(string keyInput)
{
        var  appProxy = XmlRpcProxyGen.Create<apptest>();
        appProxy.Url = "http://localhost:8080/xmlrpc/";
        return appProxy.GetName(keyInput);

}

So now your C# client can talk to Google App Engine backend with ease.

Isn't it simple? But it took me a few days to figure this out.

2 comments:

Erick Jhonson said...
This comment has been removed by the author.
Erick Jhonson said...

It is very useful post on very useful subject. I am inspired of your blog content shared on it. I expect the standard in future.
hard drive recovery