Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which approach to use?
Message
De
15/03/2002 06:49:54
 
 
À
05/03/2002 17:03:31
Information générale
Forum:
ASP.NET
Catégorie:
Web Services
Divers
Thread ID:
00628713
Message ID:
00633301
Vues:
24
Hi,

While implementing the soapheaders on the client is complicated, using the soap toolkit, in .NET everything works very simply like this:

Define your soapheader class

Imports System
Imports System.Web.Services.Protocols

Public Class MySoapHeader
Inherits SoapHeader

Public User As String
Public Password As String

End Class



Define your webservice like this:



Public Class WebServiceName
Inherits System.Web.Services.WebService

Public credentials As MySoapHeader

Public Function _
ValidUser() As String

if credentials.user="X" and credentials.password="Y" then
Return "valid user"
Else
Return "not a valid user"
End If

End Function

End Class



Now all the web service client has to do is this:



Dim header As New localhost.MySoapHeader()
header.User = "x"
header.Password = "y"

Dim Valid As New localhost.WebServiceName()
Valid.MySoapHeaderValue = header


Try
TextBox1.Text = Valid.ValidUser()
Catch soapErr As SoapException
TextBox1.Text = soapErr.Message
End Try



Hope this helps
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform