'c# SSIS Script Task Error The method or operation is not implemented
I'm using SQL Server 2017 \ SSIS \ Visual Studio 2019. I am trying to build a web scraping task that will pass the values to a SQL table, via a c# Script Component transformation.
The script consists of two parts:
main.cs:
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
try
{
WebScrape WBScrape = new WebScrape();
Row.DescriptionText = WBScrape.read_text_page(Row.Links);
}
catch (Exception UnknownError1)
{
MessageBox.Show(UnknownError1.Message);
}
}
And WebScrape.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.Net;
using System.IO;
namespace SC_68c409392de64cb2b3012e25a1dc514c
{
class WebScrape
{
const string HTML_TAG_PATTERN = @"(<(!--|script) (.|\n[^<]) * (--|script)>)|(<|<) (/?[\w!?]+)\s?[^<]*(>|>)|(\&[\w]+\;)";
private string StripHTML(string inputString) => Regex.Replace(inputString, HTML_TAG_PATTERN, string.Empty);
public string read_text_page (string pagelink)
{
string tempstring = string.Empty;
int count = 0;
string hold_temp_values = string.Empty;
// used to build entire input
StringBuilder sb = new StringBuilder();
//used on each read operation
byte[] buf = new byte[8192];
//prepare the web page we will be asking for
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(pagelink);
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36";
// execute the request
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// we will read data via the response stream
Stream resStream = response.GetResponseStream();
do
{
// fill the buffer with data
count = resStream.Read(buf, 0, buf.Length);
WebScrape tempString = null;
// make sure we read some data
if (count != 0)
{
//transalate from bytes to ASCII text
tempstring = Encoding.ASCII.GetString(buf, 0, count);
// continue building the string
sb.Append(tempString);
}
}
while (count > 0); // any more data to read?
hold_temp_values = StripHTML(sb.ToString()).Trim();
if (hold_temp_values.Length > 8000)
{
hold_temp_values = hold_temp_values.Substring(0, 8000);
}
else
{
}
return hold_temp_values;
}
}
internal class HttpWebRequest
{
public string UserAgent { get; internal set; }
internal HttpWebResponse GetResponse()
{
throw new NotImplementedException();
}
public static explicit operator HttpWebRequest(WebRequest v)
{
throw new NotImplementedException();
}
}
}
When I execute the SSIS package I receive a message box stating:
The method or operation is not implemented
This is obviously firing from the main.cs - but what does it actually mean - where do I need to look?
Thanks for any help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
