xml-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sam Ruby" <ru...@nc.rr.com>
Subject Alternate source for StockQuoteService
Date Sat, 05 Aug 2000 18:10:11 GMT
I don't know what others have found, but I've found the i3solutions stock
quote service to be flakey. I've found another source, and below are the
diffs required to make the switch.  (Though it might be smart to change the
deployment descriptor too...)

diff -u -r1.4 StockQuoteService.java
--- StockQuoteService.java      2000/07/20 14:38:54     1.4
+++ StockQuoteService.java      2000/08/05 17:40:33
@@ -72,15 +72,15 @@

   public float getQuote (String symbol) throws Exception {
     // get a real (delayed by 20min) stockquote from
-    // http://www.i3solutions.com/quote.asp. The IP addr
+    // http://www.xmltoday.com/examples/stockquote/. The IP addr
     // below came from the host that the above form posts to ..
-    URL url = new URL
("http://38.203.242.4/i3localweb/ProcessQuote.asp?txtQuery="+symbol);
+    URL url = new URL
("http://www.xmltoday.com/examples/stockquote/getxmlquote.vep?s="+symbol);
     InputStream is = url.openStream ();
     Document d = xpl.read ("stock quote", new InputStreamReader (is));
     Element e = d.getDocumentElement ();
     NodeList nl = e.getElementsByTagName ("price");
     e = (Element) nl.item (0);
-    String quoteStr = DOMUtils.getChildCharacterData (e);
+    String quoteStr = e.getAttribute ("value");
     try {
       return Float.valueOf (quoteStr).floatValue ();
     } catch (NumberFormatException e1) {


Mime
View raw message