question

Upvotes
Accepted
1 1 1 2

How can I use proxy settings on ExtractionsContext C# examples

I'm trying to get field list for TickHistoryTimeAndSales report using below proxy settings. It does not seem to be working. Could you please tell me how to use the proxy setting in the QickStart C# examples?

var ExtractionsContext = new ExtractionsContext(new Uri("https://hosted.datascopeapi.reuters.com/RestApi/v1/"), "UserName", "Password");

var proxy = new WebProxy("http://MyProxy:Port", true);

var credentials = new NetworkCredential("UserName", "Password"); ExtractionsContext.Options.UseProxy = true;

ExtractionsContext.Options.Proxy = proxy;

ExtractionsContext.Options.Proxy.Credentials = credentials;

var availableFields = ExtractionsContext.GetValidContentFieldTypes(ReportTemplateTypes.TickHistoryTimeAndSales);

tick-history-rest-apic#proxy
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

It is okay if I only set proxy without NetworkCredential.

However, if I set NetworkCredential, it will not work. I will investigate this issue and keep you posted.

Upvotes
Accepted
55.8k 144 45 65

DSS .NET SDK version 11.3 is available. From my test, it supports proxy with Network Credential. You can download it from here.

The code is:

ExtractionsContext extractionsContext =
                 new ExtractionsContext(dssUri, dssUserName, dssUserPassword);

WebProxy proxy = new WebProxy("http://proxy:port/", true);
proxy.Credentials = new NetworkCredential("proxyuser", "proxypassword");
extractionsContext.Options.Proxy = proxy;
extractionsContext.Options.UseProxy = true;
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
16 0 2 5

Hi,

I am trying the following:

var ExtractionsContext = new ExtractionsContext(new Uri("https://hosted.datascopeapi.reuters.com/RestApi/v1/"), "[username]", "[password]");

var proxy = new WebProxy("http://proxy:80", true);

ExtractionsContext.Options.UseProxy = true;

ExtractionsContext.Options.Proxy = proxy;

//ExtractionsContext.Options.Proxy.Credentials = credentials;

var availableFields = ExtractionsContext.GetValidContentFieldTypes(ReportTemplateTypes.TickHistoryTimeAndSales);

But still I am getting the following error. However if I try url in IE it works fine. Any help is appreciated.

An exception of type 'ThomsonReuters.Dss.Api.InvalidResponseException' occurred in mscorlib.dll but was not handled in user code
Additional information: Invalid response, could not parse the following response:
<!--samlchecks_get.html --><!DOCTYPE html><html><head><title>Welcome To Zscaler Directory Authentication</title><meta name="viewport" content="width=device-width, initial-scale=1"><style type="text/css">body { background-color: #FFF; font-family: Arial, sans-serif; font-size: 12px; text-align: center; color: #4B4F54; overflow: hidden; margin: 0;}a { color: #009dd0; cursor: pointer; text-decoration: none;}form { width: 100%; height: 100%; margin: 0; padding: 0;}input { font-family: Arial; font-size: 100%; margin: 0; width: 100%; vertical-align: top; color: #424242; display: inline-block; border: none; padding: 0; text-align: left; height: 100%; width: calc(100% -35px);}table { margin-top: 10px; text-align: center; background-color: white;}table.table-company-logo { background-color: #e3e3e3;}table.table-upper { border-radius: 10px;}table.table-lower { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; background-color: #f3f3f3;}table.table-field-label { margin-bottom: 2px;}table.table-field-input div.input-wrapper { display: block; border-color: #2a2c30;; width: inherit; padding-left: 10px;}table.table-field-input .input-wrapper.disabled { border-color: #cfd0d1;}table.zsc-company { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; background-color: #f3f3f3;}table.zsc-company td { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; font-size: 11px; color: #939393;}.table-half-column-fixed { width: 356px;}table + table, td table { margin-top: 0;}td.td-field-label { font-size: 16px; color: black;}td.td-field-act { font-size: 13px; color: #009dd0;}td.td-field-act img { vertical-align: middle;}img { max-height: 80px; max-width: 430px;}img.act-icon { padding-right:3px;}.or { background: #ff9500;}.gr { background: #e3e3e3;}.gy { background: #939597;}.yl { background: #ffc800;}.red { background: #c20000;}.pg { position: absolute; top: 0; bottom: 0; left: 0; right: 0; white-space: nowrap; height: 100%; overflow: auto;}.pg:before { content: ""; display: inline-block; height: 100%; vertical-align: middle;}.pg_cont { display: inline-block; vertical-align: middle; width: 100%;}.m_tbl { width: 90%; min-width: 600px; max-width: 758px; max-height: 258px; background: #FFF; white-space: normal; border: 3px solid #399c1d; border-radius: 10px;}.m_tbl.tbl_error { border-color: #77797c;}.eu_h.tbl_error { color: #77797c;}.eu_h { vertical-align: middle; font-weight: bold; border-radius: 10px; font-size: 24px; color: #399c1d; font-weight: normal; padding: 20px 20px 0 20px;}.sm { font-size: 20px; color: #696A6D; font-weight: normal;}.eu_co { font-size: 14px; color: #696A6D; white-space: normal; padding: 0 20px;}.eu_co.bsubmit { padding: 0 20px 20px 20px;}.eu_l { width: 500px; overflow: hidden; text-overflow: ellipsis; margin: 0 auto; line-height: normal;}.eu_l a { color: #0069AA; word-break: break-word;}.bh { min-height: 40px; display: block; max-height: 80px; color: #0076A9; font-size: 32px; overflow: hidden; padding-bottom: 15px;}.btn { background: #009dd0; color: #FFFFFF; border-radius: 5px; border: 2px solid #009dd0; cursor: pointer; display: inline-block; height: 30px; margin: 15px 0 15px; font-size: 18px; line-height: 26px; width: auto; padding: 0 20px;}.btn:focus, input:focus { outline: none;}.btn:hover { background: #fff; color: #0076A9;}.fo { height: 40px; line-height: 40px; font-size: 11px; padding-bottom: 0px; background-color: #f3f3f3; width: 100%; border-bottom-left-radius: 7px; border-bottom-right-radius: 7px; padding-left: 25px;}.ln { font-size: 13px; padding: 0 0 35px; font-style: italic;}.pb20 { padding-bottom: 20px;}.pb35 { padding-bottom: 35px;}.eu_co.st { font-size: 12px; padding: 10px 0; line-height: 20px; position: relative;}.ie-label { display: none;}.w-sp { -webkit-animation: spinner .8s linear infinite; animation: spinner .8s linear infinite; border: 2.5px solid #c6c6c6; border-radius: 100%; display: inline-block; height: 13px; position: relative; width: 13px; vertical-align: middle; top: -2px; margin-right: 6px;}.w-sp.grn { border-top-color: #399c1d;}.w-sp.gry { border-top-color: #77797c;}@-webkit-keyframes spinner { to { -webkit-transform: rotate(360deg); }}@keyframes spinner { to { transform: rotate(360deg); }}.not { color: #fd4239; font-size: 16px; padding-left: 0; padding-top: 0;}.demo-icon { color: green;}.s_img { vertical-align: bottom; padding-right: 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TTOP42KPWECvheHqO9m9c2IUPV5KL8dT0EQ+hbmo6R1ml8/nr1SyTf8jUWw4HL2HYBCFrUjSi6zK/L7NboLzjXaYh4vggqh4rWOOfcu7UOAGx/VQnvX9QAni6FvPw5rVSqxOeQQwp0bn9U0l6p9ELK7lwXnjcLw6ql7AZ6nqf/gJ+FuAAQDyhegdUpDo7QAAAABJRU5ErkJggg==") no-repeat; width: 55px; height: 17px; display: inline-block;}.f_btn + .f_btn { margin-left: 5px;}.f_btn { display: inline-block;}.arrow-box { padding: 15px; position: absolute; background: white; text-align: left; line-height: 16px; width: 295px; top: -40px; display: none; z-index: 10; border: 1px solid #c2a200; border-radius: 5px; padding: 15px; color: #c2a200; font-size: 13px;}.arrow-box li { list-style-type: none; color: #2a2c30;}.arrow-box-left { top: -10px; left: -335px;}.arrow-box-left:after, .arrow-box-left:before { left: 100%; top: 53px; border: solid transparent; content: " "; height: 0; width: 0; position: absolute;}.arrow-box-left:after { border-color: transparent; border-left-color: #FFFFFF; border-width: 5px; margin-top: -34px;}.arrow-box-left:before { border-color: transparent; border-left-color: #c2a200; border-width: 6px; margin-top: -35px;}.arrow-box-right { right: -335px; top: -20px;}.arrow-box-right:after, .arrow-box-right:before { right: 100%; top: 53px; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; pointer-events: none;}.arrow-box-right:after { border-color: transparent; border-right-color: #FFFFFF; border-width: 5px; margin-top: -24px;}.arrow-box-right:before { border-color: transparent; border-right-color: #c2a200; border-width: 6px; margin-top: -25px;}.input-wrapper { height: 30px; line-height: 30px; margin-bottom: 10px; border: 1px solid #b0b0b0; position: relative; display: block; width: inherit; padding-left: 10px;}.input-wrapper div.input-wrapper-div-text { text-align: left; color: #b0b0b0; max-width: 334px; overflow: hidden; text-overflow: ellipsis;}.input-image { width: 17px; display: inline-block; vertical-align: middle; height: auto; float: left; position: absolute; top: 5px; width: 20px; height: 20px; left: 7px;}.input-wrapper.dotted-border { border: none; border-bottom: 1px dotted #77797C;}.error-content { overflow-y: auto; height: auto;}.error-content li { list-style-type: none;}.text-label-link { height: 32px; line-height: 32px; margin-bottom: 10px; text-align: left; padding-left: 10px; position: absolute; top: 0px; right: -100px;}.text-label-link.pwd { right: -140px;}.text-label-link:before { content: "<<"; letter-spacing: -0.15em; padding-right: 2px; font-size: 8px; line-height: 11px; color: #3892B8; vertical-align: middle;}.username { width: calc(100% -35px); display: inline-block; vertical-align: top; color: #424242; position: relative; overflow: hidden;}.button-link { width: auto; height: auto; background: none; color: #0076A9; text-decoration: underline; cursor: pointer; vertical-align: middle;}.hide { display: none;}.err-tri { width: 0; height: 0; border-top: 15px solid transparent; border-bottom: 15px solid transparent; position: absolute; top: 40px;}.err-tri-to-left { border-right: 15px solid #FF9130; left: -15px;}.err-tri-to-right { border-left: 15px solid #FF9130; right: -15px;}.err-tri-new { display: none; -ms-transform: rotate(45deg); -webkit-transform: rotate(45deg); transform: rotate(45deg); width: 16px; height: 16px; /*right: -9px; top: 47px;*/ right: -14px; top: 6px; position: absolute; border: 1px solid #c2a200;}.username_placeholder { font: 14px/normal sans-serif; left: 7px; top: 8px; width: 332px; height: 20px; position: absolute; overflow-x: hidden; font-size-adjust: none; font-stretch: normal; text-align: left; color: #939393;}.username_input { position: relative; top: 6px; height: 20px; left: -27px; z-index:15;}input.username_input { width: 295px;}.table-left-column, .table-right-column { width: 50%; display: inline-block;}.table-left-column table { padding-right: 10px;}.table-right-column table { padding-left: 10px;}.separator { height: 14px; margin-left: 8px; margin-right: 8px; border-left: 1px #cfd0d1 solid;}hr { background-color: #cfd0d1; margin-top: 16px; margin-bottom: 16px;}.eu_sh { font-size: 16px; color: #929496; vertical-align: middle; padding: 10px 20px 0 23px;}.eu_h_t { padding-left: 23px; font-size: 16px; color: #2a2c30;}.eu_h_t span { color: #009dd0;}.eu_co_aup_txt { font-size: 13px; color: #2a2c30; padding: 0 20px 0 23px;}.eu_co_aup_txt div { max-width:715px; word-wrap: break-word; overflow-x: hidden;}.eu_h_t_sub { font-size: 16px; color: #77797c; padding: 0 0 0 23px; display: inline-block; padding-bottom: 15px; margin-right: -15px;}.eu_h_t_sub_a { padding-left: 0; padding-bottom: 15px; display: inline-block; text-align: left;}.eu_h_t_sub_a a { font-size: 16px; color: #009dd0; padding: 0 0 0 23px; width: 215px;}.otp { background-color: white; padding-left: 0; padding-top: 16px; font-size:11px;}@media only screen and (max-width:640px) { .eu_l { width: 250px; } .input-wrapper { width: 100%; } .arrow-box { background: #FFFFFF; border: 1px solid #c2a200; width: 524px; } .arrow-box-right { top: -140px; left: -1px; } .arrow-box-left { top: -80px; left: -3px; } .arrow-box-left:after, .arrow-box-left:before, .arrow-box-right:after, .arrow-box-right:before { top: 117%; left: 48%; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; } .arrow-box-right:after { border-color: transparent; border-top-color: #FFFFFF; border-width: 15px; margin-left: -15px; margin-top: -20px; } .arrow-box-right:before { border-color: transparent; border-top-color: #c2a200; border-width: 16px; margin-left: -16px; margin-top: -20px; } .arrow-box-left:after { border-color: transparent; border-top-color: #FFFFFF; border-width: 15px; margin-left: -15px; margin-top: -9px; } .arrow-box-left:before { border-color: transparent; border-top-color: #c2a200; border-width: 16px; margin-left: -16px; margin-top: -9px; } .text-label-link, .text-label-link.pwd { right: 0; top: 25px; } .table-left-column, .table-right-column { width: 100%; display: block; } .table-left-column table, .table-right-column table { padding-left: 0; padding-right: 0; } .eu_co_aup_txt div { white-space: normal; word-wrap: break-word; }}@media only screen and (max-width: 480px) { .table-half-column-fixed { width: inherit; } input.username_input { left: -2px; width: 100%; } .eu_co_aup_txt div { white-space: normal; word-wrap: break-word; } .m_tbl { min-width: 300px; } .pg_cont { position: relative; left: -3px; } .fo { text-align: center; }}</style></head><body><div><div><table width="100%" cellspacing="0" cellpadding="0"><tr><td><img id="cmpy_info" src="https://login.zscloud.net:443/smsamlq" id="uform"><input type="hidden" name="urlosfc" size="25" value="origurl=https:%2F%2Fhosted.datascopeapi.reuters.com%2fRestApi%2fv1%2fAuthentication%2fRequestToken&wexps=1&_ordtok=3ZZ3WV5m5V7hHwvwwwJ7DDrkqj&wexps=1"><input type="hidden" name="urlodmn" size="25" value="https:%2F%2Fhosted.datascopeapi.reuters.com%2fRestApi%2fv1%2fAuthentication%2fRequestToken"><input type="hidden" name="saml_id" size="25" value="FQZPZVLH3S4kr"><input type="hidden" name="jscript" size="4" value="0set"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="padding-bottom:15px; padding-top:15px;">Please wait a moment while we launch our security service.</td></tr></tbody></table></form></div></td></tr></tbody></table></div></div><script type="text/javascript">if (document.forms && document.forms[0] && document.forms[0].jscript) {document.forms[0].jscript.value = "1set";}document.forms[0].submit();</script></body></html>, ErrorId=entity-parse-error, StatusCode=500, Context=NullObjectSpace, Method=RequestToken occurred
'

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.