none
HttpWebRequest issue RRS feed

  • Question

  • I'm having problems about URL call webservice, because i want replace URL "http://lon.openskies.navitaireinside.com/servlet/rpcrouter" to "111.222.333.444" with port is "9000" but WebRequest.Create not accept IP


    void HttpSOAPRequest(String xmlfile, string proxy)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(@"D:\demo\project\WebSite1\" + xmlfile);


            HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://lon.openskies.navitaireinside.com/servlet/rpcrouter");


            req.Headers.Add("SOAPAction", "\"\"");
            req.ContentType = "text/xml;charset=\"utf-8\"";
            req.Accept = "text/xml";
            req.Method = "POST";
            try
            {
                Stream stm = req.GetRequestStream();
                doc.Save(stm);
                stm.Close();
                WebResponse resp = req.GetResponse();
                stm = resp.GetResponseStream();
                StreamReader r = new StreamReader(stm);
                // process SOAP return doc here. For now, we'll just send the XML out to the browser ...
                Response.Write(r.ReadToEnd());

            }
            catch (System.Net.WebException webe)
            {
                Response.Write(webe.Response);
               // return null;
            }
        }
    Wednesday, August 27, 2008 9:32 AM

Answers