This seems to work...

Martijn

   public String getQuote(String strTicker)
   {
      String strReturn = "";
      String strSOAPPacket = getSOAPQuote(strTicker);
      //strReturn = strSOAPPacket;
      //String strTest = cli.getQuote("IBM");
      int nStart = strSOAPPacket.indexOf(
         "<Result xsi:type='xsd:float'>") + 29;
      int nEnd = strSOAPPacket.indexOf("</Result>");
      strReturn = strSOAPPacket.substring(nStart,nEnd);
      return strReturn;
   }
   private String getSOAPQuote(String strTicker) {
       String strReturn = "";
       String strSOAPENV = "<?xml version = '1.0' encoding = 'UTF-8'?>";
       strSOAPENV += "<SOAP-ENV:Envelope xmlns:SOAP-ENV=";
       strSOAPENV += "'http://schemas.xmlsoap.org/soap/envelope/' ";
strSOAPENV += "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ";
       strSOAPENV += "xmlns:xsd='http://www.w3.org/2001/XMLSchema'>   ";
       strSOAPENV += "<SOAP-ENV:Body>      ";
strSOAPENV += "<ns1:getQuote xmlns:ns1='urn:xmethods-delayed-quotes' ";
       strSOAPENV += "SOAP-ENV:encodingStyle="
               + "'http://schemas.xmlsoap.org/soap/encoding/'>";
strSOAPENV += "<symbol xsi:type='xsd:string'>"+ strTicker + "</symbol>"
               + "</ns1:getQuote>";
       strSOAPENV += "</SOAP-ENV:Body></SOAP-ENV:Envelope>";
       String SOAPUrl = "http://64.124.140.30:9090/soap";;
       String SOAPAction = "";
       // Create the connection where we're going to send the file.
       try {
           URL url = new URL(SOAPUrl);
           URLConnection connection = url.openConnection();
           HttpURLConnection httpConn = (HttpURLConnection) connection;
           // Set the appropriate HTTP parameters.
           httpConn.setRequestProperty("Content-Length", String
                   .valueOf(strSOAPENV.length()));
           httpConn.setRequestProperty("Content-Type",
                   "text/xml; charset=utf-8");
           httpConn.setRequestProperty("SOAPAction",
                   "urn:xmethods-delayed-quotes#getQuote");
           httpConn.setRequestMethod("POST");
           httpConn.setDoOutput(true);
           httpConn.setDoInput(true);
           // Everything's set up; send the XML that was read in to
           // the service.
           OutputStream out = httpConn.getOutputStream();
           out.write(strSOAPENV.getBytes());
           out.close();
           // Read the response and write it to standard out.
           InputStreamReader isr = new InputStreamReader(httpConn
                   .getInputStream());
           BufferedReader in = new BufferedReader(isr);
           String inputLine;
           while ((inputLine = in.readLine()) != null)
               strReturn += inputLine;
           in.close();
       } catch (Exception e) {
           e.printStackTrace();
       }
       return strReturn;
   }

Martijn Dashorst wrote:

All,

I'm willing to write a blog entry on creating custom components using Wicket (a la the JSF article on the serverside, http://www.theserverside.com/articles/article.tss?l=BuildingCustomJSF).

I need to call a stock quote web service in order to increase the WOW factor (not world of warcraft) factor. Anybody got any code to share?

Martijn



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to