I want to send a XML document from my azure server to another server. When i run that code on localhost - all work fine but when i publish it on azure server doesn't wait for response and i don know why. Any ideas what's wrong in this code?
my c# code:
XmlDocument MysoapEnvelopeXml = new XmlDocument();
MysoapEnvelopeXml.LoadXml(MyXMLString);
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(MySoapURL);
webRequest.Headers.Add(@"SOAP:Action");
webRequest.ContentType = "text/xml;charset=\"utf-8\"";
webRequest.Accept = "text/xml";
webRequest.Method = "POST";
webRequest.Proxy = null;
webRequest.Timeout = 20000;
string MysoapResult ="";
using (Stream stream = webRequest.GetRequestStream())
{
MysoapEnvelopeXml.Save(stream);
}//send it
using (WebResponse response = webRequest.GetResponse())
{
using (StreamReader rd = new StreamReader(response.GetResponseStream()))
{
MysoapResult= rd.ReadToEnd();
return MysoapResult;
}
}//get resp
No comments:
Post a Comment