Skip to main content

Call a Web Service from a WebService Task

Declares an 'HttpConnection' targeting a SOAP WSDL endpoint (the legacy webservicex.net stockquote service) and a 'FileConnection' that creates the response XML at 'c:\Output.XML'. The 'WebServiceTask.GetXML' package runs a single 'WebService' task that points at the 'StockQuote' service and 'GetQuote' web method, pulls the 'symbol' input from the 'User::StockSymbol' variable, and writes the returned XML to the file connection. 'OverwriteWsdlFile="true"' refreshes the local WSDL stub each run, and the external WSDL path is set to 'c:\qoute.wsdl' as an existing file.

The webservicex.net stockquote service has been retired and is no longer reachable; the snippet is preserved as a complete example of wiring a 'WebService' task to an HTTP connection, an external WSDL, a file output, and a variable-bound input parameter. Swap the endpoint and methods for any live SOAP service you need to call.

<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>
<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>

Submitted by John Minkjan.