473,725 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling Web Service with authentication

75 New Member
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 NetworkCredenti als 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.SecureSe rvice
Dim Domino As New authenticate.he lloService

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
Dim Cred As New NetworkCredenti al(TextBox1.Tex t, TextBox2.Text ) ' Set User Name/Password credentials
Try
DominoWS.Creden tials = Cred ' assign credential to web service
DominoWS.PreAut henticate = True ' force credentials in first call
TextBox3.Text = DominoWS.getUse rName()
TextBox3.Text = DominoWS.getDbN ame() ' 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
1 3002
Dököll
2,364 Recognized Expert Top Contributor
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 NetworkCredenti als 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

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

Similar topics

17
14789
by: Patrick | last post by:
I am almost certain that I could use HTTP Post/Get to submit XML Web Service call (over SSL as well, if using Version 3 of MSXML2) from an ASP Application? However, would I only be able to call web-service in a an asynchronous mode (with a callback function)? If so, how?
0
1659
by: Michael Brandt Lassen | last post by:
Hi gurus This problem is about calling Web services secured by Forms Authentication from Windows Forms user controls embedded in HTML. Using the object tag I’ve managed to include a Windows Forms user control in my HTML page (a .NET alternative to good old ActiveX). I’d like to use my control to call web-services instead of using behaviours (webservices.htc).
1
5795
by: Bucky Pollard | last post by:
I have a web service that needs to create a batch file and call it (since there are no APIs for the functionality I am looking for). I am using the Process and ProcessStartInfo objects. When I try to call the batch file, it just returns with a return code of 1. When I call cmd.exe, and pass the batch file as a parameter it hangs. After much frustration and aggrevation, I found that CMD IS in fact running, but it is running under the context...
2
5293
by: Filippo | last post by:
Hi, I have to call a .Net WebService from a non .net Webserver. So I create an asp page that use the Soap Toolkit for calling the Webserver. The problem is that the webservice use authentication, by using the header of the soap request. How can I send this information to the webservice? Thanks in advance
1
1420
by: Jaime Stuardo | last post by:
i all, I have a web service in a Windows 2003 Server machine and ASP.NET 2.0. The website has windows integrated security so that, in order to allow domain users to connect to it, I add permissions using Front Page Server extensions. What about calling the web service over the Internet? do I need to create a special account on the machine and allow access to the website? Do you have an example of calling a web service under these...
0
1329
by: han zhiyang | last post by:
I have two new questions. 1. my exception handling codes works well when I synchronously call a web service,but How can I use it in asynchronously calling? I tried in the same way,but when error happened,my main programe is always waiting the response from the service,but nothing is returned,until I terminate it by myself.Any help on "how to" ,thanks. 2.I found the web.config file in asp.net somewhat confusing.I work under the version 2...
1
1566
by: fallenidol | last post by:
hi i'm looking for some heads up info regarding calling and using a web service from within another web service. is this acceptable practice? if not why? what should i be thinking about here? cheers
7
10865
by: GD | last post by:
Hi, I am trying to call a webservice from a windows service application. It works only if I launch the windows service app from VS.Net 2005 (Worked around from Main()) or from a winform test application. However, it generates a kind of security error after I install and start the service in my Window Server machine. I believe that it is related to authentication. The following is the sample code: HttpWebRequest obj =...
2
3000
by: =?Utf-8?B?Uk5vZWw=?= | last post by:
I implemented a J2EE web service on Sun's Application Server 8. The web service is set up to require BASIC authentication. I created a Java client that passes credenttials for the authentication and all went well. I then tried to add a web reference to a client project in .NET using VB. My code is essentially (WSRef is the name of my added web service reference): Dim ws As New WSRef.X_WS Dim oper As New WSRef.myOper Dim cred As New...
0
8889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.