0

I'm running MSSQL 2008 R2.

I want to be able to dynamically change the Web Reference URL in a Script Task when the package is deployed in different environments without having to change it manually and build it again each time.

I've got the Script Task to work with the Test Web Service,

I've added the Wed Reference in the Script Task and set the URL behaviour to "Dynamic".

I've got a Package Variable called "WebServiceURL".

so what do I need to do now in the Script Task for it to use the "WebServiceURL" package variable when calling the Web Service.

I know very little C# .Net.

Thanks in advance.

Mazhar
  • 3,797
  • 1
  • 12
  • 29

1 Answers1

0

Take a look at this question.

How can I dynamically switch web service addresses in .NET without a recompile?

You probably want to set the .URL property of the class that calls the web service to the URL from your package variable, since the .config file for SSIS packages varies depending on where it is called from.

You can read a package variable by selecting the specific variable in the "Custom Properties / Read Only Variables" property in the window that you get when you first double click on a script task. Once its selected, you can use it in your code (the Variables class is automatically generated with each variable as a property).

Community
  • 1
  • 1
N West
  • 6,768
  • 25
  • 40
  • Thanks. However, my knowledge of C# .Net is very limited. The link you've provided and this one (http://www.codeproject.com/Articles/12317/How-to-make-your-Web-Reference-proxy-URL-dynamic) both talk about Visual Studio projects and not SSIS script tasks. If you have a link to an example or tutorial on ny specific issue can be resolved that would be great. – Mazhar Apr 25 '14 at 12:12