struggling with soap authenitication

Last post 02-12-2008 2:08 PM by jamesstill. 1 replies.

Sort Posts:

  • struggling with soap authenitication

    02-12-2008, 5:58 AM
    • Member
      1 point Member
    • leadixon
    • Member since 01-13-2008, 4:16 PM
    • Posts 15

    ok i am not very good with asp.net but am trying to use soap authentication on my webservice this what i done so far and i dont no what else to do.

    Public Class AuthenticationHeader

    Inherits SoapHeader

    Public username As String

    Public password As String

    End Class

    then in my webservice i have done this:

    Imports AuthenticationHeader

    Imports System.Web

    Imports System.Web.Services

    Imports System.Web.Services.Protocols

    Imports System.Data

    Imports System.Data.SqlClient

    Public Class StockPriceInherits System.Web.Services.WebService

    Public Auth As AuthenticationHeader

    Function authenticate(ByVal a, ByVal b) As Boolean

    Dim test As String

    Dim test1 As String

    If Auth.username = test And Auth.password = test1 Then

    Return True

    Else

    Return False

    End If

    End Function

     

    <WebMethod(), SoapHeader("auth")> Public Function GetStockPrice() As DataSet

    If authenticate() = True Then

    run my prices stuff etc

    else

    return false

    End if

    end sub

    if anyone knows what wrong that would be great or somewhere i can get a really detailed tutorial on soap authentication

     regards lea dixon

  • Re: struggling with soap authenitication

    02-12-2008, 2:08 PM
    Answer
    • Member
      612 point Member
    • jamesstill
    • Member since 04-27-2007, 12:57 PM
    • Portland, Oregon
    • Posts 82
    Intel published a great white paper on using custom SOAP headers for authentication. In your code above it looks like you need to pass the credentials into the authenticate method.
    James Still
    SquareWidget LLC
    Handcrafted .NET Software
    http://www.squarewidget.com
Page 1 of 1 (2 items)