I'm trying isolate a problem I'm having making an XML RPC call:
XDocument doc = new XDocument();
doc.Add(new XElement("methodCall",
new XElement("methodName", "send"),
new XElement("params",
new XElement("param", new XElement("value", new XElement("string", this.ApiKey))),
new XElement("param", new XElement("value", new XElement("string", this.FromAddress))),
new XElement("param", new XElement("value", new XElement("string", recipient))),
new XElement("param", new XElement("value", new XElement("string", contents)))
)
)
);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://urlremoved");
req.ContentType = "text/xml";
req.Method = "POST";
XmlTextWriter writer = new XmlTextWriter(req.GetRequestStream(), Encoding.UTF8);
doc.Save(writer);
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
return reader.ReadToEnd();
This just stalls and never times out (even if I set timeouts on req.TimeOut and req.ReadWriteTimeout). I removed the url, mostly to keep the focus on just the code.
Is there anything wrong with the code that would prevent this call from being made?