This is from the IBM WSTK tutorial:
set ACTIVATION_CP="F:\Java\jaf1_0_1\jaf-1.0.1\activation.jar" set MAIL_CP="F:\Java\javamail-1_2\javamail-1.2\mail.jar" set XERCES_CP="F:\Java\Xerces-J-bin.1.4.3\xerces-1_4_3\xerces.jar" set SOAP_CP="F:\Apache\soap-bin-2.2\soap-2_2\lib\soap.jar" set NASDAQ_CP="F:\IBM\wstk-2.4\tutorial\NasdaqQuotes\lib\NasdaqQuotes.jar" java -cp %ACTIVATION_CP%;%MAIL_CP%;%XERCES_CP%;%SOAP_CP% org.apache.soap.server.ServiceManagerClient http://localhost:8080/soap/servlet/rpcrouter deploy NasdaqQuotes_Service-deploy.xml Ouch, the call failed:
Fault Code = SOAP-ENV:Server.Exception: Fault String = java.lang.NoSuchMethodError <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
id="urn:nasdaqquotes-service" checkMustUnderstands="false">
<isd:provider type="java" scope="Application" methods="getQuote"> <isd:java class="com.ibm.samples.nasdaqQuotes.NasdaqQuotes" static="false"/> </isd:provider> <isd:mappings> <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:x="urn:NasdaqQuotes" qname="x:NasdaqQuote" javaType="com.ibm.samples.nasdaqQuotes.NasdaqQuote" xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer" java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/> </isd:mappings> </isd:service> package com.ibm.samples.nasdaqQuotes;
import com.ibm.wstk.xml.XMLReader;
import org.w3c.dom.Document; import org.w3c.dom.Element; import java.net.URL; import java.net.URLConnection; import java.io.StringReader; import java.io.InputStream; public class NasdaqQuotes {
static final String surl = "http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock"; public static void main(String[] args) { try { NasdaqQuotes nq = new NasdaqQuotes(); NasdaqQuote quote = nq.getQuote(args[0]); System.out.println(quote); } catch (Exception e) { System.out.println(e); } } public NasdaqQuote getQuote(String symbol) throws Exception { // Get The Quote String nurl = this.surl + "&symbol=" + symbol; URL url = new URL(nurl); String res = doGet(url); StringReader sr = new StringReader(res); XMLReader xmlReader = new
XMLReader(sr);
Document d = xmlReader.read(); Element eq = (Element)d.getDocumentElement().getChildNodes().item(1); // Build the NasdaqQuote Object NasdaqQuote nq = new NasdaqQuote(eq); return nq; } private String doGet(URL url) throws Exception { URLConnection conn = null; InputStream in = null; String results = null; conn = url.openConnection(); byte[] buffer = new byte[0]; byte[] chunk = new byte[4096]; int count; in = conn.getInputStream(); while ((count = in.read(chunk)) > 0) { byte[] t = new byte[buffer.length + count]; System.arraycopy(buffer, 0, t, 0, buffer.length); System.arraycopy(chunk, 0, t, buffer.length, count); buffer = t; } results = new String(buffer); return results; } } package com.ibm.samples.nasdaqQuotes;
import org.w3c.dom.*;
public class NasdaqQuote {
protected String symbol; protected String market; protected double todaysHigh; protected double todaysLow; protected double fiftyTwoHigh; protected double fiftyTwoLow; protected double lastSalePrice; protected double netPriceChange; protected String netPercentChange; protected long shareVolume; protected double previousClosePrice; protected long totalShares; protected String issuerWebSite; protected String tradingStatus; private String getNodeValue(String name, Element parent)
{
return parent.getElementsByTagName(name).item(0).getChildNodes().item(0).getNodeValue(); } public NasdaqQuote() {}
public NasdaqQuote(Element e)
{
setSymbol(e.getAttribute("symbol")); setMarket(getNodeValue("market-center-code", e)); setTodaysHigh((new Double(getNodeValue("todays-high-price", e))).doubleValue()); setTodaysLow((new Double(getNodeValue("todays-low-price", e))).doubleValue()); setFiftyTwoWeekHigh((new Double(getNodeValue("fifty-two-wk-high-price", e))).doubleValue()); setFiftyTwoWeekLow((new Double(getNodeValue("fifty-two-wk-low-price", e))).doubleValue()); setLastSalePrice((new Double(getNodeValue("last-sale-price", e))).doubleValue()); setNetPriceChange((new Double(getNodeValue("net-change-price", e))).doubleValue()); setNetPercentChange(getNodeValue("net-change-pct", e)); setShareVolume((new Long(getNodeValue("share-volume-qty", e))).longValue()); setPreviousClosePrice((new Double(getNodeValue("previous-close-price", e))).doubleValue()); setTotalShares((new Long(getNodeValue("total-outstanding-shares-qty", e))).longValue()); setIssuerWebSite(getNodeValue("issuer-web-site-url", e)); setTradingStatus(getNodeValue("trading-status",e)); } public String toString() { String res = "Symbol: " + symbol + "\r\n" + "Market: " + market + "\r\n" + "Todays High: " + todaysHigh + "\r\n" + "Todays Low: " + todaysLow + "\r\n" + "52-Week High: " + fiftyTwoHigh + "\r\n" + "52-Week Low: " + fiftyTwoLow + "\r\n" + "Last Sale Price: " + lastSalePrice + "\r\n" + "Net Price Change: " + netPriceChange + "\r\n" + "Net Percent Change: " + netPercentChange + "\r\n" + "Total Share Volume: " + shareVolume + "\r\n" + "Previous Close Price: " + previousClosePrice + "\r\n" + "Total Outstanding Shares: " + totalShares + "\r\n" + "Issuer Web Site: " + issuerWebSite + "\r\n" + "Trading Status: " + tradingStatus + "\r\n"; return res; } public String getSymbol() { return symbol; } public String getMarket() { return market; } public double getTodaysHigh() { return todaysHigh; } public double getTodaysLow() { return todaysLow; } public double getFiftyTwoWeekHigh() { return fiftyTwoHigh; } public double getFiftyTwoWeekLow() { return fiftyTwoLow; } public double getLastSalePrice() { return lastSalePrice; } public double getNetPriceChange() { return netPriceChange; } public String getNetPercentChange() { return netPercentChange; } public long getShareVolume() { return shareVolume; } public double getPreviousClosePrice() { return previousClosePrice; } public long getTotalShares() { return totalShares; } public String getIssuerWebSite() { return issuerWebSite; } public String getTradingStatus() { return tradingStatus; } public void setSymbol(String symbol) { this.symbol = symbol; } public void setMarket(String market) { this.market = market; } public void setTodaysHigh(double todaysHigh) { this.todaysHigh = todaysHigh; } public void setTodaysLow(double todaysLow) { this.todaysLow = todaysLow; } public void setFiftyTwoWeekHigh(double fiftyTwoHigh) { this.fiftyTwoHigh = fiftyTwoHigh; } public void setFiftyTwoWeekLow(double fiftyTwoLow) { this.fiftyTwoLow = fiftyTwoLow; } public void setLastSalePrice(double lastSalePrice) { this.lastSalePrice = lastSalePrice; } public void setNetPriceChange(double netPriceChange) { this.netPriceChange = netPriceChange; } public void setNetPercentChange(String netPercentChange) { this.netPercentChange = netPercentChange; } public void setShareVolume(long shareVolume) { this.shareVolume = shareVolume; } public void setPreviousClosePrice(double previousClosePrice) { this.previousClosePrice = previousClosePrice; } public void setTotalShares(long totalShares) { this.totalShares = totalShares; } public void setIssuerWebSite(String issuerWebSite) { this.issuerWebSite = issuerWebSite; } public void setTradingStatus(String tradingStatus) { this.tradingStatus = tradingStatus; } } |
- which directory do the jar files go? Peoter Veliki
- Re: which directory do the jar files go? Peoter Veliki
- Peoter Veliki