Request XML from URL in SSIS C# Script Task
Occasionally, I’ve needed to pull XML from the internet via an URL. This allows you to dynamically pull XML from sources than your local.In order to do so, you’ll need a string variable (to populate with the XML from the internet) and the code below in a Script Task.
Every time you need to reference the XML in the variable, change your XML Data Sources and XML tasks to pull XML from a variable.
string Url = (string)Dts.Variables["Url"].Value;
XmlDocument doc = new XmlDocument();
doc.Load(Url); //You can use a string here if you’d like…I pull from a variable for the URL
StringWriter sw = new StringWriter();
XmlTextWriter xw = new XmlTextWriter(sw);
doc.WriteTo(xw);
sw.ToString(); Dts.Variables["Xml"].Value = sw.ToString();




I tried request xml script task. How do I get ouput of this url to xml?