Click here to Skip to main content
Email Password   helpLost your password?

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:

Image1.jpg

This article defines a step by step approach to using a Web Service call in SQL Integration Services.

First, create a web service project.

image2.jpg

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:

image3.jpg

Figure 3 - Create an SSIS Package

Add a web service task:

image4.jpg

Figure 4 - SSIS Toolbox

image5.jpg

Figure 5 - Web Service Task

Next, modify the Web Service task:

image6.jpg

Figure 6 - Edit Web Service Task

image7.jpg

Figure 7 - Web Service Task Editor

Now, define the HTTP connection:

image8.jpg

Figure 8 - HTTP Connection Manager Editor

The next step is to define the WSDL file:

image9.jpg

Figure 9 - Web Service Task Edit (Definition of the WSDL file)

Define the Web Service Task inputs:

image10.jpg

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

image11.jpg

Figure 11 - Web Service Task Editor (Definition of Web Service output properties)

image12.jpg

Figure 12 - File Connection Manger

Results

The following is the encoded output from the Web Service, stored in a test.txt file:

<?xml version="1.0" encoding="utf-16"?>
<int>200</int>

References

  1. Web Service Task, SQL Server 2005 Books Online
You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
Generalin case of 403 error
search00
10:57 2 Dec '09  
First, thanks for the article! I have a couple of comments (Windows XP, SQL Server 2005):

1. specifying http://localhost for a webservice is not enough; the port must be included, too, or a 403 error (access forbidden) will be thrown. The correct syntax may look like
http://localhost:3503

2. on Windows all slashes must be forward slanting otherwise the URI can't be parsed.
GeneralCalling a Web Service from a SQL Integration Services package
kulkarni anil 10
11:15 5 May '09  
How do we capture the integer result into a variable, for the strings it's working fine but i have problem when my webservice returns integer.
Guide me on this.
GeneralRe: Calling a Web Service from a SQL Integration Services package
Lokesh Lal
19:56 25 Aug '09  
have u tried changing the data type of the variable to int
GeneralJust one more step
Mycroft Holmes
18:51 14 Apr '08  
a thought - how to get the data from the web service into a Table.

If the web service output is an XML recordset then the it could be stored into a variable and passed into a stored proc for processing into a table!

I can see I will need to go through this article in detail - thanks.

Never underestimate the power of human stupidity
RAH

Generalcool
Niiiissssshhhhhuuuuu
10:00 7 Apr '08  
thanks!!

Regards Rose,
Nishu

GeneralThis is actually helpful
defwebserver
6:14 7 Apr '08  
You would think the information in this article is obvious but it is not. Most of it is obvious but with SSIS one wrong setting and it doesn't work and you don't know why. Tutorials are a must. The article is appreciated.


Last Updated 7 Apr 2008 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2010