By: Daniel Calbimonte | Last Updated: 2014-07-09 | Comments (19) | Integration Services Development
In this tip, we will learn how to work with Web Services using SQL Server Integration Services (SSIS). We will use a simple example to call a web service from SSIS and store the results in a file.
A web service is a method over the network used to share information between applications. Web services are very common these days to retrieve game matches, the weather, stock quotes, etc.
In this tip, we are going to work with a web service that pulls weather information. To begin with, your server running SSIS must have internet access.
Sample Web Service - Global Weather
- Using your browser, open the
http://www.webservicex.net/globalweather.asmx web service and click on the
- Specify the City and the Country and press the "Invoke" button.
- You will be able to see weather information such as wind, temperature and other
related information in an XML format.
As you can see, this web service is simple. It is a XML file with results that are published on the web and you can invoke it with your application. Let's retrieve this information using SSIS.
Setting up SSIS package to call a web service
- Open SSDT or BIDS and create a new SSIS Project.
- Drag and drop the Web Service Task onto the Design pane.
- Double click on the Web Service Task and create a new HTTP connection.
- In the Server URL textbox, specify the web service address: "http://www.webservicex.net/globalweather.asmx?WSDL" and press the Test Connection button.
- Create an empty wsld file. For this example I created a file
called mywsld in the "C:\Webservice" folder.
- In the WSDL File property specify the path of the file created in the step 5. Make sure that the OverwriteWSDLFile option is set to true and press the Download WSDL button.
- In the Input tab, specify the City and the Country.
In this sample, we used New York and United States. Press OK.
- In the Output tab, in the File properties, select "New Connection".
- Select the "Create file" option in the Usage type.
- In the File textbox, specify the path of the file to store the results of the Web Service and press OK.
This is the file where the XML data will be written to when the package is
run and the web service is called.
- Run the SSIS project.
- Open the file created in the path specified in step 10 and you can
see the XML output that was created from the web service.
As you can see, the process to invoke a Web Service is very simple. If you have any questions, feel free to write your comments and questions below.
- Take this further and read the created XML file and import directly into your database. Also, pass in the parameters for city and country dynamically. Also explore other web services to get data such as stock quotes, sports scores and more.
- For more information, refer to the following links:
Last Updated: 2014-07-09
About the author
View all my tips