Installing the ms webservices sdk got me thinking about ws-security. I've read a number of articles and tried to read the spec but really needed to code.
So I started with WS-Security Authentication and Digital Signatures with Web Services Enhancements http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwssecur/html/wssecauthwse.asp
I built a simple webservice and test client based on the code in the article. Didn't work because the service isn't getting a SoapContext, ie
(I wish I knew how to insert code snippets so they would look better)
[WebMethod]
public string HelloWorld()
{
string response = "";
SoapContext reqContext = RequestSoapContext.Current;//wse 2.0
if(reqContext == null)
{
throw new ApplicationException("Non-SOAP request");
}
Always throws. The client code is just:
Test1.localhost.SvcWse svc = new Test1.localhost.SvcWse();
UsernameToken userTok = new UsernameToken("Username", "Password", PasswordOption.SendHashed);
svc.RequestSoapContext.Security.Tokens.Add(userTok);
svc.Url = "http://trichards/WS-Security_Svc1/Svc.asmx";
Console.WriteLine(svc.HelloWorld());
More RTM is required. Not asking for help here. This is just part of the learning process. Sometimes I just need to play around for a while and then re-read what I thought that I had read.