【问题标题】:Need to add username and password to SOAP header in VB.NET Web Service Client需要在 VB.NET Web 服务客户端的 SOAP 头中添加用户名和密码
【发布时间】:2011-08-25 00:19:34
【问题描述】:

我需要查询基本身份验证的 Web 服务,将用户名和密码放在请求标头中。我的客户端是用 VB.NET Visual Basic Express Edition 2010 编写的。我已将 Web 服务添加到服务参考中。它为我自动生成了适当的类。我编写了以下非常简单的代码:

Dim imageService As AverittWebServices.SendWebImageClient = New AverittWebServices.SendWebImageClient("SendWebImagePort")
Dim imageResult As String

imageResult = imageService.getAvailableImages("")
DisplayLabel.Text = imageResult

我收到来自服务的响应,表明我需要在 SOAP 标头中包含用户名和密码。问题是我似乎找不到将用户名和密码插入标题的方法。我有它们,但没有明显的使用方法。

【问题讨论】:

标签: vb.net web-services authentication soap client


【解决方案1】:

我知道引用的代码是用 C# 编写的,但在 VB.net 中运行应该不难:

http://imar.spaanjaars.com/363/how-do-i-pass-credentials-to-a-web-service-that-uses-basic-authentication

【讨论】:

猜你喜欢
  • 2011-12-15
  • 2016-04-18
  • 1970-01-01
  • 2015-09-19
  • 1970-01-01
  • 1970-01-01
  • 2017-02-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多