我正在开发的 NAnt 构建系统有一些
有人有建议吗?
最佳答案
您可以使用<script language="C#">
.
http://nant.sourceforge.net/release/0.92/help/tasks/script.html
<script language="C#">
<code>
<![CDATA[
public static void postToWebservice() {
....
}
]]>
</code>
</script>
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("https://WEB_URL");
myReq.Method = "POST";
myReq.ContentType = "text/xml";
myReq.Timeout = 30000;
myReq.Headers.Add("SOAPAction", ":\"#save\"");
byte[] PostData = Encoding.UTF8.GetBytes(xmlDocument);
myReq.ContentLength = PostData.Length;
using (Stream requestStream = myReq.GetRequestStream())
{
requestStream.Write(PostData, 0, PostData.Length);
}
HttpWebResponse response = (HttpWebResponse)myReq.GetResponse();
关于web-services - 如何从 NAnt 调用 Web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24822690/