You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Sam Ruby <ru...@nc.rr.com> on 2000/08/05 20:10:11 UTC

Alternate source for StockQuoteService

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) {