Quello che sto cercando di fare qui è fare richiesta di posta a Rest webserivce con dati xml.Come si chiama Rest Webserivce con un metodo post e si inviano dati xml in C#
questo è quello che ho in questo momento, ma non sono sicuro come passare i miei dati XML
XElement xml = new XElement("MatchedOptions",
from m in _matchedOptionsList
select new XElement("Listing",
new XElement("DomainID", _trafficCopInputs.DomainID),
new XElement("AdSource", _trafficCopInputs.AdSource),
new XElement("Campaign", _trafficCopInputs.Campaign),
new XElement("AdGroup", _trafficCopInputs.AdGroup),
new XElement("RedirectURL", m.RedirectPath),
new XElement("FunnelKeyword", m.FunnelKeyword)));
HttpWebRequest req = WebRequest.Create("http://something.com/")
as HttpWebRequest;
req.Method = "POST";
req.ContentType = "text/xml";
req.ContentLength = 0;
StreamWriter writer = new StreamWriter(req.GetRequestStream());
writer.WriteLine(xml.ToString());
Suggerirei di definire il WebClient nella parte superiore dell'istruzione using. In questo modo, il nome webClient è locale al blocco using e non vi è alcun rischio di chiamare metodi su webClient dopo che è stato eliminato. – ctford