Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / June 2004

Tip: Looking for answers? Try searching our database.

Learning WSE2.0

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ben Bloom - 17 Jun 2004 19:34 GMT
I'm getting a SoapHeaderException when I play with adding a
UsernameToken to a Soap message. I'm trying to learn how to use WSE
Authentication for a new project and I'm essentially setting up a
HelloWorld.

My client code is as follows:

proxy.Service1Wse wseProxy = new proxy.Service1Wse();
wseProxy.RequestSoapContext.Security.Tokens.Add( new        
        UsernameToken(txtUser.Text,
                txtPw.Text,
            PasswordOption.SendPlainText));
txtResponse.Text += wseProxy.HelloPlain("button2");

and my Web Service method looks like this:

[WebMethod]
public string HelloPlain(string name)
    {
    if (RequestSoapContext.Current.Security.Tokens.Count > 0)
        return "Greater than 0 tokens.";
    return "Received: " + name;
    }

This is the error I receive.

An unhandled exception of type
'System.Web.Services.Protocols.SoapHeaderException' occurred in
system.web.services.dll

Additional information: Microsoft.Web.Services2.Security.SecurityFault:
The security token could not be authenticated or authorized
   at
Microsoft.Web.Services2.Security.Tokens.UsernameTokenManager.OnLogonUserFailed(UsernameToken
token)
   at
Microsoft.Web.Services2.Security.Tokens.UsernameTokenManager.LogonUser(UsernameToken
token)
   at
Microsoft.Web.Services2.Security.Tokens.UsernameTokenManager.AuthenticateToken(UsernameToken
token)
   at
Microsoft.Web.Services2.Security.Tokens.UsernameTokenManager.VerifyToken(SecurityToken
securityToken)
   at
Microsoft.Web.Services2.Security.Tokens.SecurityTokenManager.LoadXmlSecurityToken(XmlElement
element)
   at
Microsoft.Web.Services2.Security.Tokens.SecurityTokenManager.GetTokenFromXml(XmlElement
element)
   at Microsoft.Web.Services2.Security.Security.LoadXml(XmlElement element)
   at
Microsoft.Web.Services2.Security.SecurityInputFilter.ProcessMessage(SoapEnvelope
envelope)
   at Microsoft.Web.Services2.Pipeline.ProcessInputMessage(SoapEnvelope
envelope)
   at
Microsoft.Web.Services2.WebServicesExtension.BeforeDeserializeServer(SoapServerMessage
message)

I'm developing with VS.NET 2003 and WSE 2.0.  Any advice on what I need
to do to successfully attach a token to a message?

Thanks.

-Ben
Jag - 18 Jun 2004 00:24 GMT
Hi Ben,

Are you using your current windows credentials ? What I mean is your
windows username and password. WSE 2.0 is using the win 32 api
LogonUser to authenticate a user based on the username token.If you
want to use custom authentication have a look at the sample that comes
with Hands-On Lab Lab Manual for WS 2.0. All you need to do is set up
a custom Security Token manager.

Hope this helps.

Jag

> I'm getting a SoapHeaderException when I play with adding a
> UsernameToken to a Soap message. I'm trying to learn how to use WSE
[quoted text clipped - 62 lines]
>
> -Ben
Ben Bloom - 18 Jun 2004 14:32 GMT
Hi Jag,

For this sample, I was originally using my current windows account.  I
changed it around so I'm using a different Windows account, capturing
the username/password from a text field on a form.  (ie. new
UsernameToken(txtUser.Text, txtPw.Text, PasswordOption.SendPlainText) )

For my final implementation, I'll need to use something other than the
current windows logon, but hope to be able to pass a username/password
that matches up to a Windows account on the web service server.

When you say "Hands-On Lab Manual" are you talking about the samples
included in the install? Or something else?

Thanks.
-Ben

> Hi Ben,
>
[quoted text clipped - 8 lines]
>
> Jag
Curt Hagenlocher - 18 Jun 2004 13:20 GMT
> I'm getting a SoapHeaderException when I play with adding a
> UsernameToken to a Soap message. I'm trying to learn how to use WSE
[quoted text clipped - 5 lines]
> Additional information: Microsoft.Web.Services2.Security.SecurityFault:
> The security token could not be authenticated or authorized

Are you using Windows 2000?  If so, you'll have to grant the ASPNET
user rights to "Act as part of the operating system"

--
Curt Hagenlocher
curt@hagenlocher.org
Ben Bloom - 18 Jun 2004 14:26 GMT
> Are you using Windows 2000?  If so, you'll have to grant the ASPNET
> user rights to "Act as part of the operating system"

I am using Windows 2000.  I just tried to grant access as you describe,
but I still get the same error.

Thanks..
-Ben
Curt Hagenlocher - 18 Jun 2004 15:34 GMT
>> Are you using Windows 2000?  If so, you'll have to grant the ASPNET
>> user rights to "Act as part of the operating system"
>
> I am using Windows 2000.  I just tried to grant access as you describe,
> but I still get the same error.

1. You may need to restart the ASP process in order for the updated
permission to take effect.  I'd probably just reboot to achieve that.
2. If you're part of an Active Directory domain and are not connected
to a domain controller, the change in permissions will not take effect
until you become connected to the controller.  I imagine this is true
because the domain policies need to be checked.

--
Curt Hagenlocher
curt@hagenlocher.org
Ben Bloom - 18 Jun 2004 16:07 GMT
> 1. You may need to restart the ASP process in order for the updated
> permission to take effect.  I'd probably just reboot to achieve that.
> 2. If you're part of an Active Directory domain and are not connected
> to a domain controller, the change in permissions will not take effect
> until you become connected to the controller.  I imagine this is true
> because the domain policies need to be checked.

Not running an AD domain.  I'll give the reboot a try.

Thanks.
Ben Bloom - 18 Jun 2004 16:23 GMT
>> 1. You may need to restart the ASP process in order for the updated
>> permission to take effect.  I'd probably just reboot to achieve that.
[quoted text clipped - 6 lines]
>
> Thanks.

Thanks Curt.  The reboot got rid of my error.  (Of course - Step 1 in
diagnosing MS problems: Reboot. :) )

Now I can get back to causing problems.
Jag - 20 Jun 2004 12:58 GMT
Hi Ben
You can get the Hands-On Lab Manual by downloading the
HOL-WSE-Security.EXE form the microsoft web site.

Regards
Jagdeep

> >> 1. You may need to restart the ASP process in order for the updated
> >> permission to take effect.  I'd probably just reboot to achieve that.
[quoted text clipped - 11 lines]
>
> Now I can get back to causing problems.
Ben Bloom - 20 Jun 2004 22:57 GMT
Thanks Jag.  Eventually I got smart and searched for Hands-On Lab for
WSE and found it.  I'm well on my way now.

> Hi Ben
> You can get the Hands-On Lab Manual by downloading the
[quoted text clipped - 18 lines]
>>
>>Now I can get back to causing problems.
dm_dal - 21 Jun 2004 21:08 GMT
Thanks Curt,
I had posted the same issue on 6/8 but didn't get any responses.  This
cleared up my problem.

dmy

> > I'm getting a SoapHeaderException when I play with adding a
> > UsernameToken to a Soap message. I'm trying to learn how to use WSE
[quoted text clipped - 12 lines]
> Curt Hagenlocher
> curt@hagenlocher.org

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.