I'm trying to perform the same scenario as in the following link; Create a SSIS Script Component as a Data Source that uses a pre-existing HTTP Connection Manager to retreive a page with GET and emit rows into the Data Flow pipeline.
http://www.sqlis.com/sqlis/post/Downloading-a-file-over-HTTP-the-SSIS-way.aspx
My target platform is SQL Server 2008 and therefore C#. The MSDN documentation gives examples of File and SQL Connection Managers but not HTTP ones.
https://msdn.microsoft.com/en-us/library/ms136060%28v=sql.100%29.aspx
The specific problem is that I can NOT figure out why there's no HttpClientConnection constructor in my current context. The MSDN documentation of that class does not seem to apply in the case of Script Components and translating this to something useful is apparently beyond me.
My non-working code looks like this –
using System;
using System.Data;
using System.Text;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
public override void AcquireConnections()
{
IDTSConnectionManager100 connMgr = this.Connections.MyWebServer;
}
public override void PreExecute()
{
base.PreExecute();
HttpClientConnection clientConn = new HttpClientConnection(connMgr));
Byte[] buffer = clientConn.DownloadData();
String Document = Encoding.ASCII.GetString(buffer);
}
What am I missing?
Best Answer
i know it's been a while since the question but i found a possible solution.
This link provides an explanation and examples of how to use the connections available in the connection manager enabled for the Script Component in the SSIS https://msdn.microsoft.com/en-us/library/ms136060.aspx
The portion of code that we are interested is this: