Calling a Service and create DOMDocument from Response with AppEngines URLFetch

This is rather simple task and well documented is the part on doing the call. Though in my case the response is a XML and I want it as a DOMDocument to do my thing. And here is the short snippet for a method that does the call and populates the DOMDocument:

private Document domDocument;

private void doCall(String serviceUrl){
 try {
 URL url = new URL(serviceUrl);
 try {
 DocumentBuilder parser = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder();
 domDocument = parser.parse(new InputSource(new InputStreamReader(url.openStream(),"UTF-8")));
 } catch (ParserConfigurationException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 } catch (SAXException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 } catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 }

 } catch (MalformedURLException e) {
 System.out.println(e);
 //TODO do something about exceptions
 } catch (IOException e) {
 System.out.println(e);
 }
 }

I use this private method in some other methods of my service to do the different calls to a service (search, look for a specific item etc.). After the call I do work on the populated domDocument and create the objects. What’s missing yet is some generic error checking built into the doCall method. But that’s something I do later on.

Tapestry on GAE/J: java.lang.VerifyError Stack size too large (SOLVED)

All the sudden I get this error right at start and can’t recall what I’ve actually done to the project to provoke that. It did work well till that point. Anyway, it was apparentely because of some unnecessary code and has been solved in the trunk and against the 5.1 development branch. So I downloaded that (via anonymous SVN access), compiled it and replaced only the failing class in the original and stable Tapestry Core 5.1.0.5.jar.

After that, I get another error (good start since I at least got it running again):

<small><small>java.lang.ClassFormatError: Invalid length 65050 in LocalVariableTable</small></small>

But luckily this had been solved by Dmitry Gusev and posted on his blog. Thanks for that!

Now all up and running again. Till the next stop….

java.lang.ClassFormatError: Invalid length 65050 in LocalVariableTable

Great site about Google AppEngine Java Edition

Wow, at http://gaejexperiments.wordpress.com/ you will find heaps of tutorials and hints on Googles AppEngine. Thanks to Romin K. Irani, who assembled all of them and even provides them for downloads as an 227 pages strong eBook.