Note that there are some explanatory texts on larger screens.

plurals
  1. POC# Client to Consume Google App Engine RESTful Webservice (rpc XML)
    text
    copied!<p>I think I hit a problem when using C# client to consume Google App Engine Webservice. The Google App Engine code I use <a href="http://appengine-cookbook.appspot.com/recipe/xml-rpc-server-using-google-app-engine/" rel="nofollow noreferrer">is here</a>. This is how the python script on server would look like:</p> <pre><code>from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app import logging from StringIO import StringIO import traceback import xmlrpclib from xmlrpcserver import XmlRpcServer class Application: def __init__(self): pass def getName(self,meta): return 'example' class XMLRpcHandler(webapp.RequestHandler): rpcserver = None def __init__(self): self.rpcserver = XmlRpcServer() app = Application() self.rpcserver.register_class('app',app) def post(self): request = StringIO(self.request.body) request.seek(0) response = StringIO() try: self.rpcserver.execute(request, response, None) except Exception, e: logging.error('Error executing: '+str(e)) for line in traceback.format_exc().split('\n'): logging.error(line) finally: response.seek(0) rstr = response.read() self.response.headers['Content-type'] = 'text/xml' self.response.headers['Content-length'] = "%d"%len(rstr) self.response.out.write(rstr) application = webapp.WSGIApplication( [('/xmlrpc/', XMLRpcHandler)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() </code></pre> <p>The client side ( in Python) is this:</p> <pre><code>import xmlrpclib s = xmlrpclib.Server('http://localhost:8080/xmlrpc/') print s.app.getName() </code></pre> <p>I have no problem in using Python client to retrieve values from Google App Engine, but I do have difficulties in using a C# client to retrieve the values. The error I got was <code>404 method not found</code> when I am trying to <code>GetResponse</code> from the web request. </p> <p>This is my code</p> <pre><code> var request = (HttpWebRequest)WebRequest.Create("http://localhost:8080/xmlrpc/app"); request.Method = "GET"; request.ContentLength = 0; request.ContentType = "text/xml"; using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) //404 method not found error here. { } </code></pre> <p>Edit: For end points, I've tried:</p> <ol> <li><a href="http://localhost:8080/xmlrpc" rel="nofollow noreferrer">http://localhost:8080/xmlrpc</a></li> <li><a href="http://localhost:8080/xmlrpc/" rel="nofollow noreferrer">http://localhost:8080/xmlrpc/</a></li> <li><a href="http://localhost:8080/xmlrpc/app" rel="nofollow noreferrer">http://localhost:8080/xmlrpc/app</a></li> <li><a href="http://localhost:8080/xmlrpc/app/" rel="nofollow noreferrer">http://localhost:8080/xmlrpc/app/</a></li> </ol> <p>But none works</p> <p>I think it must be that the url is wrong, but I don't know how to get it right. Any idea?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload