FileDocCategorySizeDatePackage
PriceService.javaAPI DocExample1369Tue Oct 09 11:03:40 BST 2001com.ecerami.soap

PriceService

public class PriceService extends Object
A Sample SOAP Service Provides Current Price for requested Stockkeeping Unit (SKU)

Fields Summary
protected Hashtable
products
Constructors Summary
public PriceService()
Zero Argument Constructor Load product database with two sample products

    products = new Hashtable();
    //  Red Hat Linux
    products.put("A358185", new Double (54.99));
    //  McAfee PGP Personal Privacy
    products.put("A358565", new Double (19.99));
  
Methods Summary
public doublegetPrice(java.lang.String sku)
Provides Current Price for requested SKU In a real-setup, this method would connect to a price database. If SKU is not found, method will throw a PriceException.

    Double price = (Double) products.get(sku);
    if (price == null) {
      throw new ProductNotFoundException ("SKU: "+sku+" not found");
    }
    return price.doubleValue();