var uri = new Uri("http://localhost/SOAP/SOAPSMS.asmx/add");
var req = (HttpWebRequest) WebRequest.CreateDefault(uri);
req.ContentType = "text/xml; charset=utf-8";
req.Method = "POST";
req.Accept = "text/xml";
req.Headers.Add("SOAPAction", "http://localhost/SOAP/SOAPSMS.asmx/add");
var strSoapMessage = @"<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<soap:Body><add xmlns='http://tempuri.org/'><a>23</a><b>5</b></soap:Body>
</soap:Envelope>";
using (var stream = new StreamWriter(req.GetRequestStream(), Encoding.UTF8))
stream.Write(strSoapMessage);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…