Reputation: 11
I have an SSIS package which has a script task. It has of course the usual Script main class file, it uses a couple of web services so I used the WSDL command line too to generate a couple of proxy classes for those in the project. All works fine.
I defined a couple of read-only User:: variables to be used by the script task which define the URL paths of the two web services.
Problem : in the two web service proxy classes I seem not to have access to the Dts variables collection. I've tried adding the using Microsoft.SqlServer.Dts.Runtime;
to each of the proxy classes but still cannot access those Dts variables within the proxy classes.
Is there a way to do this?
Upvotes: 1
Views: 2463
Reputation: 21
I was able to pass the variables to a class constructor by passing the ScriptObjectModel.
// in the ScriptMain class
YourWsClass ws = new YourWsClass(Dts);
//in the WS class
using Microsoft.SqlServer.Dts.Tasks.ScriptTask;
class YourWsClass
{
public YourWsClass(ScriptObjectModel dts)
{
string _v = (string)dts.Variables["User::YourVariable"].Value;
}
}
Upvotes: 2
Reputation: 7214
You won't be able to access the variables directly anywhere else than in the ScriptMain
class. You have to pass the variable to your proxy class when you instantiate it.
// in the ScriptMain class
YourWsClass ws = new YourWsClass(Dts.Variables["User::YourVariable"].Value.ToString();
class YourWsClass
{
public YourWsClass(String v)
{
_v = v;
}
}
Upvotes: 1