Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

HashTable not working in axis web service

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my webservice code....




/**
*/

package stocks.soapservices;

import java.util.Hashtable;

import stocks.util.StockQuote;

/**
* StockQuoteService.java
*
* SOAP based Stock Quote Services include : - addQuote() - to add a new stock
* quote - getQuote() - to get the current price of a given stock symbol -
* getAllQuotes() - to get all the quotes in the database
*
* for demo purposes, this service contains an 'init' method to load some same
* stock quotes.
*
*/

public final class StockQuoteService {
public final Hashtable stockData;

/**
* Constructor
*/

public StockQuoteService() {
stockData = new Hashtable();
init(); // Usually initializes JDBC Access in a real-world situation
}

/**
* Add/Update a stock quote
*
* @param StockQuote
*/

@SuppressWarnings("unchecked")
public boolean addQuote(StockQuote stockQuote) {
if (stockQuote != null) {
stockData.put(stockQuote.getSymbol().trim(), stockQuote);
ServerNotificationHandler.getInstance().dataChanged();
return true;
}
return false;
}

public boolean deleteQuote(String symbol) {
if (symbol != null) {
stockData.remove(symbol);
ServerNotificationHandler.getInstance().dataChanged();
return true;
}
return false;
}

/**
* Get the StockQuote for a specified Stock Symbol
*
* @param String
* @return StockQuote
*/

public StockQuote getQuote(String symbol) {
return (StockQuote) stockData.get(symbol);
}

/**
* Get all the StockQuotes from the database.
*
* @return Hashtable
*/

public Hashtable getAllQuotes() {
return stockData;
}

/**
* Initialize temporary data for demo purpose only
*
*/

private void init() {
stockData.put("CSCO", new StockQuote("CSCO", "Cisco", 19.62));
stockData.put("INTC", new StockQuote("INTC", "Intel", 33.81));
stockData.put("IBM", new StockQuote("IBM", "IBM", 122.20));
stockData.put("MSFT", new StockQuote("MSFT", "Microsoft", 69.27));
stockData.put("ORCL", new StockQuote("ORCL", "Oracle", 15.05));
stockData.put("SUNW", new StockQuote("SUNW", "Sun", 12.58));
}

}



------------------------------


The problem i am facing now is i am not able to get the hashtable from the getAllQuotes method...



this is the response for the getAllQuotes method

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:getAllQuotesResponse xmlns:ns="http://soapservices.stocks">
<ns:return xsi:type="axis2ns1:anyType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ax23="http://util.stocks/xsd">
<empty xmlns="http://www.w3.org/2001/XMLSchema">false</empty>
</ns:return>
</ns:getAllQuotesResponse>
</soapenv:Body>
</soapenv:Envelope>
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic