Arrays in WebService SSIS 2008
-
Friday, May 11, 2012 2:48 PMSo I have a Web Service that works just fine when I enter the parameter values myself. I get results and can parse it out, storing the results into a table. I even have it working in a "For Each Loop" for one of my variables. The issue I have is that the Web Service accepts 3 variables, the first being an Array. How can I populate the array variable for web service? If it requires a script, can I get an example to a link to one? I'm not very familiar with scripts.
Werner
All Replies
-
Friday, May 11, 2012 2:50 PMModerator
-
Friday, May 11, 2012 2:50 PM
I've never tried it, but the first thing I would suggest is to create an object variable and then create/load the array via a script task. Then see if you can pass the object variable in for the Array param.
If that does not work, then it is relatively easy to use a webservice in a script task if you first create the proxy classes in a Visual studio project and then copy the resulting code into a script task.
Here's an example
Chuck
- Edited by Chuck Pedretti Friday, May 11, 2012 2:51 PM
-
Sunday, May 13, 2012 8:41 PMModerator
you can create an object variable as arthur said, and fill the object variable with an Array in Script task with a simple script like this:
public void Main() { System.Collections.ArrayList arr = new System.Collections.ArrayList(); arr.Add("the first item"); arr.Add("the second item"); arr.Add("the third item"); Dts.Variables["User::Collection"].Value = arr; Dts.TaskResult = (int)ScriptResults.Success; }
- Proposed As Answer by Eileen ZhaoMicrosoft Contingent Staff, Moderator Tuesday, May 15, 2012 9:11 AM
- Marked As Answer by Eileen ZhaoMicrosoft Contingent Staff, Moderator Friday, May 18, 2012 4:49 AM
-
Monday, May 21, 2012 4:18 PM
So I've gone ahead and created a script and as a first pass, hardcoded the values to test the passing of an array is an object. What I've noticed and is causing an error is that the variable Input list first shows the type as and INT().
Click OK and Open for EDIT, review the Input list and I see that int[] has changed to int - causing a failure in the web service call.
Any ideas?Werner


