Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
XML
<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,

C#
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();
              
            }
               // declare & read response from service
            HttpWebResponse resp = req.GetResponse() as HttpWebResponse;
               // set utf8 encoding       
               Encoding enc = System.Text.Encoding.GetEncoding(1252);     
                   // read response stream from response object    
               StreamReader loResponseStream = new StreamReader
                   (resp.GetResponseStream(), enc);
               String strResult = string.Empty;
               // read string from stream data    
               strResult = loResponseStream.ReadToEnd();      
               // close the stream object    
               loResponseStream.Close();     
               // close the response object   
               resp.Close();
               return strResult;
           }

that method we are calling on page load as below

C#
var docs = XElement.Parse(CallOriginMethod());
Posted
Comments
Prasad Khandekar 6-May-13 6:21am    
Does running ping http://staging.www.wwalliance.com from command prompt returns response similar to one shown below.

Pinging staging.www.wwalliance.com [70.47.199.158] with 32 bytes of data:

Reply from 70.47.199.158: bytes=32 time=817ms TTL=51
Reply from 70.47.199.158: bytes=32 time=256ms TTL=51
Reply from 70.47.199.158: bytes=32 time=256ms TTL=51
Reply from 70.47.199.158: bytes=32 time=256ms TTL=51

Ping statistics for 70.47.199.158:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 256ms, Maximum = 817ms, Average = 396ms

It's seems to be a problem with NAME resolution. Contact your IT team and check with them.

Regards,
ZurdoDev 6-May-13 10:25am    
That's a weird way, in my opinion, to have a url. Shouldn't it just be staging.wwalliance.com? Why the extra www and in the middle of the url?

1 solution

Dear All, Thank you for your reply. I got the solution.

The issue was, when i deployed on IIS , I could have pass my account details, which i haven't done and that was not allowing me to browse the url.

Please reach me anytime for detailed info, if not clear.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900