Introduction
The SSIS framework provides a Web Service task which executes a Web Service method. You can use the Web Service task for the following purposes:
- Writing to a variable the values that a Web Service method returns.
- Writing to a file the values that a Web Service method returns.
This article defines a step by step approach to using a Web Service call in SQL Integration Services.
First, create a web service project.
Figure 2 - Create a Web Service
Now, expose a method call in the Web Service:
public class SSISService : System.Web.Services.WebService
{
[WebMethod]
public string HelloMoon()
{
return "Hello Moon";
}
[WebMethod]
public int Multiply(int nParam1, int nParam2)
{
return nParam1 * nParam2;
}
}
Create an SSIS package:
Figure 3 - Create an SSIS Package
Add a web service task:
Figure 4 - SSIS Toolbox
Figure 5 - Web Service Task
Next, modify the Web Service task:
Figure 6 - Edit Web Service Task
Figure 7 - Web Service Task Editor
Now, define the HTTP connection:
Figure 8 - HTTP Connection Manager Editor
The next step is to define the WSDL file:
Figure 9 - Web Service Task Edit (Definition of the WSDL file)
Define the Web Service Task inputs:
Figure 10 - Web Service Task Editor (Definition of web service input properties)
Now, define the Web Service output. The output of the Web Service can be written to variables or to an output file. This sample outputs the results from the Web Service to a file system file that is defined using the File Connection Manager Editor (Figure 11).
Figure 11 - Web Service Task Editor (Definition of Web Service output properties)
Figure 12 - File Connection Manger
Results
The following is the encoded output from the Web Service, stored in a test.txt file:
="1.0"="utf-16"
<int>200</int>
References
- Web Service Task, SQL Server 2005 Books Online