I am using one rest service in my application. when I run the solution everything working fine
but when I publish the solution and browse it throwing the below error.
What all I tried ,
1. added below code in web.config
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy usesystemdefault="True"/>
</defaultProxy>
</system.net>
2. on internet tool added into trusted site the url http://staging.www.wwalliance.com
3. whet to proxy at internet tools and bypassed it with
http://staging.www.wwalliance.com\*
still no use, could you please help.
code which is used in application is below,
string CallOriginMethod()
{
string uri = "http://staging.www.wwalliance.com/webservice/rest/globalrateorigin/origin.xml?";
string Method = "POST";
HttpWebRequest req = WebRequest.Create(uri) as HttpWebRequest;
req.KeepAlive = false;
req.Method = Method.ToUpper();
if (("POST,PUT").Split(',').Contains(Method.ToUpper()))
{
string stringxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
" <GlobalrateoriginRequest xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"WWA_Rate_Lookup_origins_request_version_2.0.1.xsd\">" +
"<GlobalrateoriginEnvelope><SenderID>test_agility</SenderID><ReceiverID>restapi</ReceiverID><Password>01870fa4b08a1</Password><Type>Globalrate_Origin_Request</Type> " +
"<Version>2.0.1</Version><EnvelopeID>123</EnvelopeID></GlobalrateoriginEnvelope><GlobalrateoriginRequestDetails><Date>2013-04-25</Date><Customeralias>AGILITY</Customeralias>" +
"</GlobalrateoriginRequestDetails></GlobalrateoriginRequest>";
byte[] buffer = Encoding.ASCII.GetBytes(stringxml);
req.ContentLength = buffer.Length;
req.ContentType = "text/xml";
Stream PostData = req.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
}
HttpWebResponse resp = req.GetResponse() as HttpWebResponse;
Encoding enc = System.Text.Encoding.GetEncoding(1252);
StreamReader loResponseStream = new StreamReader
(resp.GetResponseStream(), enc);
String strResult = string.Empty;
strResult = loResponseStream.ReadToEnd();
loResponseStream.Close();
resp.Close();
return strResult;
}
that method we are calling on page load as below
var docs = XElement.Parse(CallOriginMethod());