如何向 Web 服务调用添加 HTTP 标头?
我正在从控制台应用程序调用 Web 服务 - 全部使用 .NET 上的 C# 进行。
我想向 Web 服务调用添加 HTTP 标头(不是 SOAP 标头)。我该怎么做?
这是我的代码到目前为止的样子:
EatService es = new EatService(); // web service added in Web References
// Add HTTP header X-Info = "extra info" here
string info = es.GetMoreInfo(); // ws call
I'm calling a web service from a console app - all in C# on .NET.
I want to add an HTTP header (not a SOAP header) to the web service call. How do I do this?
This is what my code looks like so far:
EatService es = new EatService(); // web service added in Web References
// Add HTTP header X-Info = "extra info" here
string info = es.GetMoreInfo(); // ws call
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用 ASMX Web 服务代理(Web 参考),那么这是 将自定义 Http 标头添加到 C# Web 服务代理。
If you are using an ASMX web service proxy (Web Reference), then this is a duplicate of Adding Custom Http Headers to C# Web Service Proxy.