Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2004, 08:07 AM
Registered User
 
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old April 28th, 2005, 08:29 AM
Registered User
 
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've just encountered the same issue. Has anyone figured out the resolution? I'm running WSE 2.0 SP 3 and suspect there may be catch in how I've added the web reference to my client project.

 
Old April 28th, 2005, 02:17 PM
Registered User
 
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

As I suspected, the web Reference I'd set up was incorrect, inadvertantly pointed it to an old version of the web service, so once I set up a new one, I was ok.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid Token sani723 XSLT 2 December 25th, 2007 01:42 AM
WSE 2.0 sabansingh .NET Web Services 0 May 15th, 2006 02:19 AM
VB 6 and WSE 2.0 ramkumars .NET Web Services 0 May 9th, 2006 04:52 AM
WSE 2.0 trouble sabansingh C# 0 February 21st, 2006 07:54 AM
Unrecognized token was found Dennis Huisman BOOK: Professional Crystal Reports for VS.NET 0 September 6th, 2004 07:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.