Link to home
Start Free TrialLog in
Avatar of CBRE_GSC2_122001
CBRE_GSC2_122001

asked on

SSIS Httpwebrequest - GetResponseStream() error - Protocol violation

HI,

I have a SSIS package and in that I am trying to fetch a csv file from an api via URL in script task. I have tried the httpwebrequest and webclient but when I try to fetch the response I get the error as "The server committed a protocol violation. Section=ResponseStatusLine".

Here is my code :

                url_ = "#####" + n.ToString();

                n = n + 50;
                HttpWebRequest wc = (HttpWebRequest) WebRequest.Create(url_);

                wc.Credentials = CredentialCache.DefaultCredentials;

                wc.ProtocolVersion = HttpVersion.Version11;
                WebResponse wr = wc.GetResponse(); //This is where i am facing issues

Any help would be appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Avodah
Avodah
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CBRE_GSC2_122001
CBRE_GSC2_122001

ASKER

Thanks Richard,

Yes that is the complete error message, I tried your these 2 suggestions as well, but no luck. Still the same message.
This is probably a protocol mismatch. Is the call required to be using HTTPS rather than HTTP.

Can you use an external program such as fiddler or postman to simulate the request and see what the response is?

Fiddler: http://www.telerik.com/fiddler
Postman: https://www.getpostman.com/