【问题标题】:soap header authentication on a VB.net clientVB.net 客户端上的soap标头身份验证
【发布时间】:2013-02-28 04:27:50
【问题描述】:

我正在开发 VB.net 客户端(excel)以连接到不公开 WSDL 上的身份验证方法的第三方 web 服务(java)。

如何在请求的标头中传递用户名和密码。没有解释soap头必须如何?

文件只说了以下内容:

Web 服务的通信是通过 WCF 中的 basicHttpBinding 提供的。此绑定支持 WSS SOAP 消息安全性、WS-Security 用户名令牌配置文件和 WS-Security X.509 证书安全性。经过测试、认证和支持的配置将传输凭据安全模式与 Windows 凭据一起使用。 “Web 服务客户端必须在 SOAP 标头中传递 Windows 帐户的用户名和密码,以向服务器和数据库层识别正确的 Windows 客户端。”

谢谢。

因此,我们将不胜感激。 我已经去了stackoverflow中的大部分线程。其中大多数是在服务器端设置的身份验证方法,在这种情况下不适用,因为我无法控制 Web 服务。

这是一对一的客户端服务器关系。

【问题讨论】:

    标签: vb.net web-services soap header wsdl


    【解决方案1】:

    是的,我已经完成了凭据部分。显然,我从其他找到解决方案的人那里复制并粘贴。

    import System.Net; 
    .... 
    dim myService as New wsService
    dim myCredentials as New Sustem.Net.CredentialCache()
    dim netCrd as Ne NetworkCredential(UserName,Password,Domain)
    myCredentials.Add(New Uri(wsServiceUrl), "Basic", netCred)
    myService.UseDefaultCredentials = false
    myService.Credentials = myCredentials
    
    dim Data1 as new DataResponse
    dataResponse = myService.getData("param1")
    

    getData 方法是通过代理方法调用的。

    但是,我仍然不知道如何自定义标头上的用户名和密码,因为我检查了 xml 请求,我看不到任何标头标签。

    任何好的 cmets 将不胜感激。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-22
      • 2019-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多