dimanche 8 février 2015

How to use HTTP Connection Manager in Script Component? (Not Script Task)


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://ift.tt/1A3SNUz


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.


http://ift.tt/1A3SOaM


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.


http://ift.tt/1A3SQj7


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?





Aucun commentaire:

Enregistrer un commentaire