title: Passing a list of parameters from a sql task in SSIS to Web Services URL with a variable
body: <p>I have a sql query that is generating a list of order numbers...I can place these order numbers individually in the web request URL to Web Services and collect the details of that order. I know how to do that if I had a WSDL file available but the We services is using a RestFul service client and has no WSDL file. I do have a C# code that will work only if I declare the order number and was trying to find out how can I replace this parameter with a DTS variable and use a Foreach loop container to run the rest of the order numbers in the list. Here's the code that I have so far:</p>
  
  <pre><code>    using System;
      using System.Collections.Generic;
      using System.Text;
      using System.Web;
      using System.IO;
      using System.Net;
      using System.Xml;
      /**
      * A test code to consuming a RESTFUL web service. 
       * You need to just parse the xml - either save it in memory/Cache to parse immediatly,
      * or wrire to file and do read and parse it.
      * @author: Jbisht
      */
      namespace JbishtApplication
      {
          class CallWeb
          {
              static void Main(string[] args)
              {
                  HttpWebRequest request = null;
                  HttpWebResponse response = null;
                  String Xml;
                  String salesOrderNo = "S3107634";
                  String file_ext = ".xml";
                  String file_name = salesOrderNo + file_ext;
                  String file_path = "C:/";
  
                  // Create the web request - Zones Test Environment - Orderws URL 
                  // request = WebRequest.Create("http://test2:8080/orderws/order/" + salesOrderNo) as HttpWebRequest;
  
                  // Create the web request - My instance - Orderws for test only
                  request = WebRequest.Create("http://dev2:10580/orderws/order/" + salesOrderNo) as HttpWebRequest;
  
                  // Get response  
                  using (response = request.GetResponse() as HttpWebResponse)
                  {
                      // Get the response stream  
                      StreamReader reader = new StreamReader(response.GetResponseStream());
  
                      Xml = reader.ReadToEnd();
                      XmlDocument xdoc = new XmlDocument();
                      xdoc.LoadXml(Xml);
                      xdoc.Save(file_path + file_name);  // it will save your response xml to file location;
                  }
                  // Console xml output  
                  Console.WriteLine(Xml); //see if we get the xml response, (YES we do)
  
                  Console.ReadLine(); // Just wrote to keep console window open after writing to console.
              }
          }
      }
  </code></pre>