X

Geertjan's Blog

  • August 5, 2005

FeedReader Client for Dummies

Geertjan Wielenga
Product Manager
Happily, my discovery of a simple feedreader web service coincided with my discovery of the NetBeans RSS feed. So, I used NetBeans IDE 4.1 to create a web application, right-clicked the project node in the Projects window, selected the New Web Service Client template in the New File wizard and then used it to generate a web service client from the feedreader web service's WSDL file. I then used the New Servlet template in the New File wizard to create a servlet, right-clicked in its processRequest method (in the Source Editor), used a menu item (Web Service Client Resources > Call Web Service Operation) to generate code that calls the feedreader service's getHTML operation, and added this between the processRequest method's <body> tags:

 //Display formatted text "Source:" at the top of the page
out.println("<center><h2><font color='blue'>Source:<br>");
//Specify hardcoded URL, because this is specifically for retrieving
//the NetBeans RSS feed (so no user input via index.jsp)
String url = "http://www.netbeans.org/rss-091.xml";
//Display hardcoded URL as link under "Source:"
out.println("<u><a href='" + url + "'/>" + url + "</a></font></u></h2>");
//Pass the URL as argument to web service and return HTML from web service
String html = getRSStoHTMLSoap().getHTML(url);
//Display HTML below text "Source:" and below hardcoded link to URL
out.println(html);

In the project's Project Properties dialog box, I put the servlet's URL mapping (first seen in the New Servlet wizard and afterwards in the WEB-INF/web.xml file) in the Run panel's Relative URL field. As a consequence, when I deployed the application, the servlet's output was displayed in my browser. The output consisted of a text, the URL to the NetBeans RSS feed, and the content of the RSS feed which the web service had converted to HTML (click to enlarge):

If there are simpler ways to create a feedreader client, I'd like to hear about it.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha