需要用户名和密码在VB.NET Web服务客户端添加到SOAP头 [英] Need to add username and password to SOAP header in VB.NET Web Service Client

查看:233
本文介绍了需要用户名和密码在VB.NET Web服务客户端添加到SOAP头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要查询一个Web服务,基本身份验证,将用户名和密码的请求头。我的客户是用VB.NET Visual Basic中前preSS 2010年版我已经添加了Web服务的服务引用。它具有自动生成相应的课给我。我已经写了下面的非常简单的code:

I need to query a web service that basic authentication, putting the username and password in the request header. My client is written in VB.NET Visual Basic Express Edition 2010. I've added the web service to the Service References. It has auto-generated the appropriate classes for me. I've written the following very simple code:

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

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

我得到回应的,表示我需要在SOAP头一个用户名和密码的服务回报。问题是,我似乎无法找到一个方法来插入用户名和密码进入头部。我有他们,但没有使用它们的明显途径。

I get a response back from the service that indicates I need to have a username and password in the SOAP header. The problem is that I can't seem to find a way to insert the username and password into the header. I have them but don't have an obvious way to use them.

推荐答案

我知道引用code是在C#中,但它不应该是很难得到它打算在VB.net:

I know the referenced code is in C#, but it shouldn't be difficult to get it going in VB.net:

<一个href=\"http://imar.spaanjaars.com/363/how-do-i-pass-credentials-to-a-web-service-that-uses-basic-authentication\" rel=\"nofollow\">http://imar.spaanjaars.com/363/how-do-i-pass-credentials-to-a-web-service-that-uses-basic-authentication

这篇关于需要用户名和密码在VB.NET Web服务客户端添加到SOAP头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆