Package samples.databinding.data

Examples of samples.databinding.data.GetStockQuoteResponse


        } catch (SAXException e) {
            throw new RuntimeException(e);
        } catch (TransformerException e) {
            throw new RuntimeException(e);
        }
        GetStockQuoteResponse stockQuoteResponse = new GetStockQuoteResponse();
        Quote quote = new Quote();
        quote.setSymbol(stockQuote.getSymbol());
        quote.setVolume(5000);

        LastTrade lastTrade = new LastTrade();
        lastTrade.setPrice(99);
        lastTrade.setDate(Calendar.getInstance().getTimeInMillis());
        quote.setLastTrade(lastTrade);

        Change change = new Change();
        change.setDollar(1);
        change.setPercent(10);
        change.setPositive(true);
        quote.setChange(change);

        stockQuoteResponse.setQuote(quote);
        SAXOMBuilder builder = new SAXOMBuilder();
        try {
            Marshaller.marshal(stockQuoteResponse, builder);
        } catch (MarshalException e) {
            throw new RuntimeException(e);
View Full Code Here


        StAXSource staxSource =
                new StAXSource(response.getXMLStreamReader());
        Unmarshaller unmarshaller = new Unmarshaller(GetStockQuoteResponse.class);
        UnmarshalHandler unmarshalHandler = unmarshaller.createHandler();
        GetStockQuoteResponse stockQuoteResponse;
        try {
            ContentHandler contentHandler = Unmarshaller.getContentHandler(unmarshalHandler);
            TransformerFactory.newInstance().newTransformer().transform(staxSource, new SAXResult(contentHandler));
            stockQuoteResponse = (GetStockQuoteResponse) unmarshalHandler.getObject();
        } catch (SAXException e) {
            throw new RuntimeException(e);
        } catch (TransformerException e) {
            throw new RuntimeException(e);
        }
        System.out.println("Price = " + stockQuoteResponse.getQuote().getLastTrade().getPrice());
    }
View Full Code Here

        }
       
        if (!stockQuote.getSymbol().equals("IBM")) {
      throw new AxisFault("StockQuote details for the symbol '"+ stockQuote.getSymbol() + "' are not available.");
        }
        GetStockQuoteResponse stockQuoteResponse = new GetStockQuoteResponse();
        Quote quote = new Quote();
        quote.setSymbol(stockQuote.getSymbol());
        quote.setVolume(5000);

        LastTrade lastTrade = new LastTrade();
        lastTrade.setPrice(99);
        lastTrade.setDate(Calendar.getInstance().getTimeInMillis());
        quote.setLastTrade(lastTrade);

        Change change = new Change();
        change.setDollar(1);
        change.setPercent(10);
        change.setPositive(true);
        quote.setChange(change);

        stockQuoteResponse.setQuote(quote);
        SAXOMBuilder builder = new SAXOMBuilder();
        try {
            Marshaller.marshal(stockQuoteResponse, builder);
        } catch (MarshalException e) {
            throw new RuntimeException(e);
View Full Code Here

        } catch (SAXException e) {
            throw new RuntimeException(e);
        } catch (TransformerException e) {
            throw new RuntimeException(e);
        }
        GetStockQuoteResponse stockQuoteResponse = new GetStockQuoteResponse();
        Quote quote = new Quote();
        quote.setSymbol(stockQuote.getSymbol());
        quote.setVolume(5000);

        LastTrade lastTrade = new LastTrade();
        lastTrade.setPrice(99);
        lastTrade.setDate(Calendar.getInstance().getTimeInMillis());
        quote.setLastTrade(lastTrade);

        Change change = new Change();
        change.setDollar(1);
        change.setPercent(10);
        change.setPositive(true);
        quote.setChange(change);

        stockQuoteResponse.setQuote(quote);
        SAXOMBuilder builder = new SAXOMBuilder();
        try {
            Marshaller.marshal(stockQuoteResponse, builder);
        } catch (MarshalException e) {
            throw new RuntimeException(e);
View Full Code Here

        StAXSource staxSource =
                new StAXSource(response.getXMLStreamReader());
        Unmarshaller unmarshaller = new Unmarshaller(GetStockQuoteResponse.class);
        UnmarshalHandler unmarshalHandler = unmarshaller.createHandler();
        GetStockQuoteResponse stockQuoteResponse;
        try {
            ContentHandler contentHandler = Unmarshaller.getContentHandler(unmarshalHandler);
            TransformerFactory.newInstance().newTransformer().transform(staxSource, new SAXResult(contentHandler));
            stockQuoteResponse = (GetStockQuoteResponse) unmarshalHandler.getObject();
        } catch (SAXException e) {
            throw new RuntimeException(e);
        } catch (TransformerException e) {
            throw new RuntimeException(e);
        }
        System.out.println("Price = " + stockQuoteResponse.getQuote().getLastTrade().getPrice());
    }
View Full Code Here

        }
       
        if (!stockQuote.getSymbol().equals("IBM")) {
      throw new AxisFault("StockQuote details for the symbol '"+ stockQuote.getSymbol() + "' are not available.");
        }
        GetStockQuoteResponse stockQuoteResponse = new GetStockQuoteResponse();
        Quote quote = new Quote();
        quote.setSymbol(stockQuote.getSymbol());
        quote.setVolume(5000);

        LastTrade lastTrade = new LastTrade();
        lastTrade.setPrice(99);
        lastTrade.setDate(Calendar.getInstance().getTimeInMillis());
        quote.setLastTrade(lastTrade);

        Change change = new Change();
        change.setDollar(1);
        change.setPercent(10);
        change.setPositive(true);
        quote.setChange(change);

        stockQuoteResponse.setQuote(quote);
       
        OMDocument document = param0.getOMFactory().createOMDocument();
        try {
            Marshaller.marshal(stockQuoteResponse, document.getSAXResult().getHandler());
        } catch (MarshalException e) {
View Full Code Here

                document.getOMDocumentElement());


        Unmarshaller unmarshaller = new Unmarshaller(GetStockQuoteResponse.class);
        UnmarshalHandler unmarshalHandler = unmarshaller.createHandler();
        GetStockQuoteResponse stockQuoteResponse;
        try {
            ContentHandler contentHandler = Unmarshaller.getContentHandler(unmarshalHandler);
            TransformerFactory.newInstance().newTransformer().transform(response.getSAXSource(false), new SAXResult(contentHandler));
            stockQuoteResponse = (GetStockQuoteResponse) unmarshalHandler.getObject();
        } catch (SAXException e) {
            throw new RuntimeException(e);
        } catch (TransformerException e) {
            throw new RuntimeException(e);
        }
        System.out.println("Price = " + stockQuoteResponse.getQuote().getLastTrade().getPrice());
    }
View Full Code Here

TOP

Related Classes of samples.databinding.data.GetStockQuoteResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.