Arvind
Arvind

Reputation: 6474

google app engine for java- using low level API to fetch data- some difficulties

In a Google App Engine for Java web app, I am trying to use the low level api to invoke an XML RPC ...After looking at the docs, I figured out the following code to connect using low level API-the reason why I want to use Low Level API is so that I can set the timeout value myself--

         String mrtime="120";
         java.lang.Double maxresponsetime;
         maxresponsetime = Double.valueOf(mrtime).doubleValue();
         HTTPRequest req=  new  HTTPRequest(url, HTTPMethod.GET, disallowTruncate().setDeadline(maxresponsetime));
         HTTPResponse response= com.google.appengine.api.urlfetch.URLFetchServiceFactory.getURLFetchService().fetch(req);
         String line="";
         String resp="";
         resp=new String(response.getContent(), "UTF-8");

The above code is suitable for a scenario where the remote URL is accessed by GAE...However I have to also send an XML message containing name of function as well as input parameters (these are stored in variable named 'message')... How do I send that message to the remote URL, and after that obtain the response?

Upvotes: 1

Views: 286

Answers (1)

Sid Malani
Sid Malani

Reputation: 2116

You should post the call method and parameters instead of GET. The method name and parameters go as XML.

See this http://xmlrpc.scripting.com/spec.html

Upvotes: 2

Related Questions