Monday, September 17, 2012

BIML WebService get a stock quote

How to execute a webservice to get a stock quote using BIML:
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
    <Connections>
        <HttpConnection Name="HTTPConnection"
                        ServerUrl="HTTP://www.webservicex.net/stockquote.asmx?wsdl"></HttpConnection>
        <FileConnection Name="FCOutputXmL"
                        FilePath="c:\\Output.XML"
                        FileUsageType="CreateFile"></FileConnection>
    </Connections>
    <Annotations>
        <Annotation>
            File: WebServiceTask.GetXML.biml
            Demo biml using the Web Service Task to
            get a stock quote
            Enviroment:
            DB: MS-SQL2012
            BIML: 1.6 VS2010 BIDS Helper
            (c) John Minkjan biml101.blogspot.com
        </Annotation>
    </Annotations>
    <Packages>       
        <Package Name="WebServiceTask.GetXML" ConstraintMode="Linear">
            <Variables>
                <Variable Name ="StockSymbol"
                          DataType="String"
                          EvaluateAsExpression="false">"CBR"</Variable>
                <!--Stock symbol has to be enclosed in double quotes-->
            </Variables>
            <Tasks>
                <WebService Name="WST Get Stock Quote"
                            ServiceName="StockQuote"
                            OverwriteWsdlFile ="true"
                            ConnectionName="HTTPConnection" 
                            WebMethod="GetQuote">
                    <ExternalWsdlFile ExternalFilePath="c:\\qoute.wsdl"
                                      FileUsageType="ExistingFile" ></ExternalWsdlFile>
                    <FileOutput ConnectionName="FCOutputXmL"></FileOutput>
                    <Parameters>
                        <Parameter  Name="symbol"
                                    DataType="String"
                                    ParameterType="Variable"
                                    VariableName="User.StockSymbol"></Parameter>
                    </Parameters>
                </WebService>
            </Tasks>
        </Package>
    </Packages>
</Biml>
Gives you:
image
Till Next Time

No comments:

Post a Comment