开发者

google app engine server reports error but on local server the code works fine

String sourceUrlString="http://maps.googleapis.com/maps/api/geocode/xml?address="+searchWord+"&sensor=true";//searchWord-parameter to be passed
Source source=new Source(new URL(sourceUrlString));

Element alpha=source.getFirstElement("location");
String beta[]=new String[100];

String lat=alpha.getContent().getFirstElement("lat").getContent().toString();
String lng=alpha.getContent().getFirstElement("lng").getContent().toString();

THE error pointed out by google app engine is in the above bold statements it says null pointer exception but on local server it returns the value and the code works fine.

wat are the possible solution to the above problem?and a开发者_如何学Cs of what i have come to conclusion is google app engine does not support Http request .is it true?


You need to use URL Fetch service to issue HTTP requests and receive responses: One example: import urllib2

url = "http://www.google.com/" try: result = urllib2.urlopen(url) doSomethingWithResult(result) except urllib2.URLError, e: handleError(e)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜