The XMLHTTPRequest will fail if you have proxy configured. we need use WinHttp instead of it. Refer the code pasted below.
if(sProxyIPAddress.Length != 0)
{
WinHttp.WinHttpRequest xmlhttp = new WinHttp.WinHttpRequest();
//Accessing the web service using Get method
xmlhttp.Open("GET", "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=" + sfromCurrencyCode + "&ToCurrency=" + sBaseCurrency , null);
xmlhttp.SetProxy(2,sProxyIPAddress, null);
xmlhttp.Send(null);
xmlresult.loadXML(xmlhttp.ResponseText);
}
else
{
//Accessing the web service using Get method
MSXML2.XMLHTTP30Class xmlhttp = new MSXML2.XMLHTTP30Class();
xmlhttp.open("GET", "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=" + sfromCurrencyCode + "&ToCurrency=" + sBaseCurrency, false, null, null);
xmlhttp.send(null);
xmlresult.loadXML(xmlhttp.responseText);
}
XMLHTTPRequest will fail if internet connection uses proxy server.
Posted by Abison Mathew Jose at 6:04 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment