3.77设置 SOAP 请求头(WebService)

创建于 2026 年 8 月 17 日约 1 分钟读完

当调用基于 SOAP 协议的 Web 服务时,通常需要在请求头中指定 SOAPAction,以便服务端识别要执行的操作。使用 SetSOAPAction 方法可快速设置该头。

cs
HttpRequestBuilder.Get("http://您的主机地址/Share/DatabaseManager.asmx")    .SetSOAPAction("http://tempuri.org/GetDatabaseList");// 自动为 SOAPAction 值添加双引号包裹(符合 SOAP 1.1 规范建议)HttpRequestBuilder.Get("http://您的主机地址/Share/DatabaseManager.asmx")    .SetSOAPAction("http://tempuri.org/GetDatabaseList", addQuotes: true);