By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,375 Members | 1,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,375 IT Pros & Developers. It's quick & easy.

Calling Web Service with authentication

P: 75
Hi All,
I have a web service created in Notes Database and i am calling the web service in Visual studio.Net application by adding a web reference.

I need to have authentication mechanism before calling the methods within the web service.I used the NetworkCredentials Property for authenticating but the user name and password is not authenticating.I am able to access the web service methods directly the authentication mechanism fails.How can i do a authentication for accessing a web service in Visual Studio.Net.I coding part is as follows.

Public Class Form1
Dim DominoWS As New secure.SecureService
Dim Domino As New authenticate.helloService

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Cred As New NetworkCredential(TextBox1.Text, TextBox2.Text ) ' Set User Name/Password credentials
Try
DominoWS.Credentials = Cred ' assign credential to web service
DominoWS.PreAuthenticate = True ' force credentials in first call
TextBox3.Text = DominoWS.getUserName()
TextBox3.Text = DominoWS.getDbName() ' call call web service
Catch ex As Exception
TextBox3.Text = ("Error:" & ex.Source & vbCrLf & ex.Message) ' Report errors
End Try
End Sub

Please help me in this ??
Thanks in Advance!!!!
May 16 '07 #1
Share this Question
Share on Google+
1 Reply


Dököll
Expert 100+
P: 2,364
Hi All,
I have a web service created in Notes Database and i am calling the web service in Visual studio.Net application by adding a web reference.

I need to have authentication mechanism before calling the methods within the web service.I used the NetworkCredentials Property for authenticating but the user name and password is not authenticating.I am able to access the web service methods directly the authentication mechanism fails.How can i do a authentication for accessing a web service in Visual Studio.Net.I coding part is as follows.
Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.     Dim DominoWS As New secure.SecureService
  3.     Dim Domino As New authenticate.helloService
  4.  
  5.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  6.         Dim Cred As New NetworkCredential(TextBox1.Text, TextBox2.Text ) ' Set User Name/Password credentials
  7.         Try
  8.             DominoWS.Credentials = Cred ' assign credential to web service
  9.             DominoWS.PreAuthenticate = True ' force credentials in first call
  10.             TextBox3.Text = DominoWS.getUserName()
  11.             TextBox3.Text = DominoWS.getDbName() ' call call web service
  12.         Catch ex As Exception
  13.             TextBox3.Text = ("Error:" & ex.Source & vbCrLf & ex.Message) ' Report errors
  14.         End Try
  15.     End Sub
  16.  
Please help me in this ??
Thanks in Advance!!!!
Hey there!

Let's give it a go in the .Net forum see what pops up:

http://www.thescripts.com/forum/forum131.html
Jun 5 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.