Package samples.common

# Class StockQuoteHandler

java.lang.Object
samples.common.StockQuoteHandler

public class StockQuoteHandler extends Object
A class that can create messages to, and parse replies from our sample StockQuote service

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StockQuoteHandler()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static org.apache.axiom.om.OMElement`
  `createCustomQuoteRequest(String symbol)`
  Create a new custom quote request with a body as follows invalid input: '<'m0:CheckPriceRequest xmlns:m0="http://services.samples"> invalid input: '<'m0:Code>symbolinvalid input: '<'/m0:Code> invalid input: '<'/m0:CheckPriceRequest>
  `static org.apache.axiom.om.OMElement`
  `createFullQuoteRequest(String symbol)`
  Create a new full quote request with a body as follows invalid input: '<'m:GetFullQuote xmlns:m="http://services.samples"> invalid input: '<'m:request> invalid input: '<'m:symbol>IBMinvalid input: '<'/m:symbol> invalid input: '<'/m:request> invalid input: '<'/m:GetFullQuote>
  `static org.apache.axiom.om.OMElement`
  `createMarketActivityRequest()`
  Create a new market activity request with a body as follows invalid input: '<'m:getMarketActivity xmlns:m="http://services.samples"> invalid input: '<'m:request> invalid input: '<'m:symbol>IBMinvalid input: '<'/m:symbol> ...
  `static org.apache.axiom.om.OMElement`
  `createPlaceOrderRequest(double purchPrice, int qty, String symbol)`
  Create a new order for a quantiry of a stock at a given price invalid input: '<'m:placeOrder xmlns:m="http://services.samples"> invalid input: '<'m:order> invalid input: '<'m:price>3.141593E0invalid input: '<'/m:price> invalid input: '<'m:quantity>4invalid input: '<'/m:quantity> invalid input: '<'m:symbol>IBMinvalid input: '<'/m:symbol> invalid input: '<'/m:order> invalid input: '<'/m:placeOrder>
  `static org.apache.axiom.om.OMElement`
  `createStandardQuoteRequest(String symbol, int itrCount)`
  Create a new quote request with a body as follows invalid input: '<'m:GetQuote xmlns:m="http://services.samples"> invalid input: '<'m:request> invalid input: '<'m:symbol>IBMinvalid input: '<'/m:symbol> invalid input: '<'/m:request> invalid input: '<'/m:GetQuote>
  `static String`
  `parseCustomQuoteResponse(org.apache.axiom.om.OMElement result)`
  Digests the custom quote response and extracts the last trade price
  `static String`
  `parseFullQuoteResponse(org.apache.axiom.om.OMElement result)`
  invalid input: '<'ns:getFullQuoteResponse xmlns:ns="http://services.samples"> invalid input: '<'ns:return> 0 -2.367492989603466 13.14956711287784 -155.58844623078153 157.47582716569198 Mon Apr 16 23:29:58 LKT 2007 -155.31924118819015 6373750.467022192 IBM Company -154.84071720443495 -17.353258031353164 -1.3910235348298898 170.1979104108393 IBM 8935 1 3.794122022240518 -8.656536789776045 176.77136802352928 170.28677783945102 Mon Apr 16 23:29:58 LKT 2007 -166.64126635049223 -6112014.916847887 IBM Company -168.30884678174925 -18.644628475049693 -2.29678289479374 -165.19288918603885 IBM 5825 ...
  `static String`
  `parseMarketActivityResponse(org.apache.axiom.om.OMElement result)`
  invalid input: '<'ns:getMarketActivityResponse xmlns:ns="http://services.samples"> invalid input: '<'ns:return> 4.183958555301184 -8.585281368244686 -158.70528805517333 160.83784480071603 Tue Apr 17 02:21:30 LKT 2007 -157.4950051860593 5.9907588733164035E7 EHM Company -160.18368223376558 24.0926205053427 -2.6141745708181374 -160.04893483420904 EHM 6319 ....
  `static String`
  `parseStandardQuoteResponse(org.apache.axiom.om.OMElement result)`
  Digests the standard StockQuote response and extracts the last trade price
  `static String`
  `randomString(int count)`
  Return a random String of letters

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### StockQuoteHandler

    public StockQuoteHandler()

- ## Method Details

  - ### createCustomQuoteRequest

    public static org.apache.axiom.om.OMElement createCustomQuoteRequest(String symbol)
    Create a new custom quote request with a body as follows invalid input: '<'m0:CheckPriceRequest xmlns:m0="http://services.samples"> invalid input: '<'m0:Code>symbolinvalid input: '<'/m0:Code> invalid input: '<'/m0:CheckPriceRequest>
    Parameters:
      `symbol` - the stock symbol
    Returns:
      OMElement for SOAP body

  - ### createStandardQuoteRequest

    public static org.apache.axiom.om.OMElement createStandardQuoteRequest(String symbol, int itrCount)
    Create a new quote request with a body as follows invalid input: '<'m:GetQuote xmlns:m="http://services.samples"> invalid input: '<'m:request> invalid input: '<'m:symbol>IBMinvalid input: '<'/m:symbol> invalid input: '<'/m:request> invalid input: '<'/m:GetQuote>
    Parameters:
      `symbol` - the stock symbol
    Returns:
      OMElement for SOAP body

  - ### createFullQuoteRequest

    public static org.apache.axiom.om.OMElement createFullQuoteRequest(String symbol)
    Create a new full quote request with a body as follows invalid input: '<'m:GetFullQuote xmlns:m="http://services.samples"> invalid input: '<'m:request> invalid input: '<'m:symbol>IBMinvalid input: '<'/m:symbol> invalid input: '<'/m:request> invalid input: '<'/m:GetFullQuote>
    Parameters:
      `symbol` - the stock symbol
    Returns:
      OMElement for SOAP body

  - ### createMarketActivityRequest

    public static org.apache.axiom.om.OMElement createMarketActivityRequest()
    Create a new market activity request with a body as follows invalid input: '<'m:getMarketActivity xmlns:m="http://services.samples"> invalid input: '<'m:request> invalid input: '<'m:symbol>IBMinvalid input: '<'/m:symbol> ... invalid input: '<'m:symbol>MSFTinvalid input: '<'/m:symbol> invalid input: '<'/m:request> invalid input: '<'/m:getMarketActivity>
    Returns:
      OMElement for SOAP body

  - ### createPlaceOrderRequest

    public static org.apache.axiom.om.OMElement createPlaceOrderRequest(double purchPrice, int qty, String symbol)
    Create a new order for a quantiry of a stock at a given price invalid input: '<'m:placeOrder xmlns:m="http://services.samples"> invalid input: '<'m:order> invalid input: '<'m:price>3.141593E0invalid input: '<'/m:price> invalid input: '<'m:quantity>4invalid input: '<'/m:quantity> invalid input: '<'m:symbol>IBMinvalid input: '<'/m:symbol> invalid input: '<'/m:order> invalid input: '<'/m:placeOrder>
    Parameters:
      `purchPrice` - the purchase price
      `qty` - the quantiry
      `symbol` - the stock
    Returns:
      an OMElement payload for the order

  - ### parseStandardQuoteResponse

    public static String parseStandardQuoteResponse(org.apache.axiom.om.OMElement result) throws Exception
    Digests the standard StockQuote response and extracts the last trade price
    Parameters:
      `result` -
    Returns:
    Throws:
      `XMLStreamException` - invalid input: '<'ns:getQuoteResponse xmlns:ns="http://services.samples"> invalid input: '<'ns:return> invalid input: '<'ns:change>-2.3238706829151026invalid input: '<'/ns:change> ... invalid input: '<'ns:symbol>IBMinvalid input: '<'/ns:symbol> invalid input: '<'ns:volume>17949invalid input: '<'/ns:volume> invalid input: '<'/ns:return> invalid input: '<'/ns:getQuoteResponse>
      `Exception`

  - ### parseFullQuoteResponse

    public static String parseFullQuoteResponse(org.apache.axiom.om.OMElement result) throws Exception
    invalid input: '<'ns:getFullQuoteResponse xmlns:ns="http://services.samples"> invalid input: '<'ns:return> 0 -2.367492989603466 13.14956711287784 -155.58844623078153 157.47582716569198 Mon Apr 16 23:29:58 LKT 2007 -155.31924118819015 6373750.467022192 IBM Company -154.84071720443495 -17.353258031353164 -1.3910235348298898 170.1979104108393 IBM 8935 1 3.794122022240518 -8.656536789776045 176.77136802352928 170.28677783945102 Mon Apr 16 23:29:58 LKT 2007 -166.64126635049223 -6112014.916847887 IBM Company -168.30884678174925 -18.644628475049693 -2.29678289479374 -165.19288918603885 IBM 5825 ... invalid input: '<'/ns:return> invalid input: '<'/ns:getFullQuoteResponse>
    Parameters:
      `result` -
    Returns:
    Throws:
      `Exception`

  - ### parseMarketActivityResponse

    public static String parseMarketActivityResponse(org.apache.axiom.om.OMElement result) throws Exception
    invalid input: '<'ns:getMarketActivityResponse xmlns:ns="http://services.samples"> invalid input: '<'ns:return> 4.183958555301184 -8.585281368244686 -158.70528805517333 160.83784480071603 Tue Apr 17 02:21:30 LKT 2007 -157.4950051860593 5.9907588733164035E7 EHM Company -160.18368223376558 24.0926205053427 -2.6141745708181374 -160.04893483420904 EHM 6319 .... 7613 ... invalid input: '<'/ns:return> invalid input: '<'ns:getMarketActivityResponse>
    Parameters:
      `result` -
    Returns:
      the average last price for each stock symbol
    Throws:
      `Exception`

  - ### parseCustomQuoteResponse

    public static String parseCustomQuoteResponse(org.apache.axiom.om.OMElement result) throws Exception
    Digests the custom quote response and extracts the last trade price
    Parameters:
      `result` -
    Returns:
    Throws:
      `XMLStreamException` - `IBM` 82.90
      `Exception`

  - ### randomString

    public static String randomString(int count)
    Return a random String of letters
    Parameters:
      `count` - number of letters
    Returns:
      the random string