user642318
user642318

Reputation: 417

soap header authentication on a VB.net client

I am developing VB.net client(excel) to connect to a thrid party webservice(java) that do not expose the authentication method on the WSDL.

How can I pass username and password in the header for the request. There is no explaination on the how the soap header must be?

The document only say the following:

Communication for Web services is provided through the basicHttpBinding in WCF. This binding supports WSS SOAP Message Security, WS-Security Username Token Profile, and WS-Security X.509 Certificate Security. The tested, certified, and supported configuration uses Transport Credential security mode with Windows Credentials. "A Web service client must pass the user name and password of the Windows account in the SOAP header to identify the correct Windows client to the server and database tiers."

Thanks.

So any comment would be appreciated. I have gone to most of the threads in stackoverflow. Most of them is authentication method which is set on the server side which is not applicable in this case as I have no control over the webservices.

This is a one-to-one client server relationship.

Upvotes: 0

Views: 6676

Answers (1)

user642318
user642318

Reputation: 417

yeap, I have done the credentials part. Obviously I copy and paste from other person who have found the solution for this.

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")

The getData method is called via the proxy method.

However, I still have no idea of customizing the Username and Password on the header, as I have checked the xml request, i could not see any header tags.

Any good comments would be appreciated.

Upvotes: 0

Related Questions