WSE 2.0 Sending Username Token
I'm trying to use WSE 2.0 in Visual Studio .NET 2003 to set up a web service to pass username and password in a token in the SOAP header.
Here's the page which sets the token (Token) and adds it to the web service proxy before calling the web service to populate a datagrid:
Public Token As New UsernameToken("OCDDdata", "support247dc", PasswordOption.SendPlainText)
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ws As New DCtoOCDDclient.refCensusService.CensusServiceWse
ws.RequestSoapContext.Security.Tokens.Add(Token)
Try
Dim dsCensus As New DataSet
dsCensus.Merge(ws.getCensus().Tables(0))
dgCensus.DataSource = dsCensus
dgCensus.DataBind()
Catch we As WebException
Label1.Text = "Failed! " & we.Message
End Try
End Sub
If I break at this point, I can see the RequestSoapContext filled with the token. However, when the web service is actually called it's missing.
<WebMethod(Description:="Basic Census info for DC's")> _
Public Function getCensus() As DataSet
GetUsernameToken(RequestSoapContext.Current)
Dim dsCensus As New DataSet
Dim Sqlstr As String
Sqlstr = "SELECT DC_NR, dcID, Name_Last, Name_First, Name_Mid, Name_Suffix, SSN, DOB, ************, Begda, Endda FROM dbo.v_DCall"
Dim daOCDD As New SqlDataAdapter(Sqlstr, ConfigurationSettings.AppSettings("connOCDD"))
daOCDD.Fill(dsCensus)
Return dsCensus
What am I missing here?
Thanks,
Joe
|