【发布时间】:2013-09-24 01:32:54
【问题描述】:
如果可以将 HTTP 标头添加到肥皂客户端 Web 服务调用中,有人可以回答我吗? 上网后,我唯一发现的就是如何添加 SOAP 标头。
代码如下:
var client =new MyServiceSoapClient();
//client.AddHttpHeader("myCustomHeader","myValue");//There's no such method, it's just for clearness
var res = await client.MyMethod();
更新:
The request should look like this
POST https://service.com/Service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.host.com/schemas/Authentication.xsd/Action"
Content-Length: 351
MyHeader: "myValue"
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header/>
<s:Body>
<myBody>BodyGoesHere</myBody>
</s:Body>
</s:Envelope>
信封中的Header属性应该为空
【问题讨论】:
标签: c# windows-8 soap-client