Check out http://code.google.com/appengine/docs/java/urlfetch/overview.html : "App Engine implements this interface using the URL Fetch service; your application does not make socket connections directly."
import java.net.MalformedURLException; import java.net.URL; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; // ... try { URL url = new URL("http://www.example.com/atom.xml"); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); String line; while ((line = reader.readLine()) != null) { // ... } reader.close(); } catch (MalformedURLException e) { // ... } catch (IOException e) { // ... } On Feb 25, 4:04 am, kghate <kgh...@gmail.com> wrote: > I am trying to get a simple URLFetchService example to work, here is > the code. > > URL url = new URL("http://www.google.com"); > URLFetchService urlFetchService = > URLFetchServiceFactory.getURLFetchService(); > HTTPRequest httpRequest = new HTTPRequest(url,HTTPMethod.GET); > HTTPResponse resp = urlFetchService.fetch(httpRequest); > System.out.println(resp.toString()); > > Getting a nullpointer in the "fetch" method > > java.lang.NullPointerException > at > com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java: > 31) > > What am I missing? Please help.. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.