Hi all,
I want to ensure that my wSE 2.0 web service is being called with at least
one security token.
I have a function that validates that using the
RequestContext.Security.Tokens collection.
Instead of calling that function from every Soap Method, I want to put this
in an HttpModule. While I haven't actually tried it yet, I believe this will
work just fine. I can get to the request's SoapContext object.
However, for future plans, I would also want access to the SoapEnvelope for
that request. I have tried hooking into three events: AUthenticateRequest,
BeginRequest, and PreRequestHandlerExecute. In all of these events, the
Envelope property of my SoapContext is Nothing (null).
Is there a way I can access the Envelope in an HttpModule?
Thanks,
---
Sven.
Pierre Greborio - 15 Dec 2004 17:19 GMT
> I want to ensure that my wSE 2.0 web service is being called with at
> least one security token.
[quoted text clipped - 6 lines]
> believe this will work just fine. I can get to the request's
> SoapContext object.
You could use a policy instead.
> However, for future plans, I would also want access to the
> SoapEnvelope for that request. I have tried hooking into three
> events: AUthenticateRequest, BeginRequest, and
> PreRequestHandlerExecute. In all of these events, the Envelope
> property of my SoapContext is Nothing (null).
I suggest to implement a filter (input or output or both) which contains all
information (security, addressing, etc).
But probaly you have to do something else ?
Regards,
Pierre

Signature
-------------------------------------------
Pierre Greborio
Microsoft .NET MVP
http://blogs.ugidotnet.org/pierregreborio
http://www.amazon.com/infopath
-------------------------------------------
SA - 15 Dec 2004 17:39 GMT
> > Instead of calling that function from every Soap Method, I want to
> > put this in an HttpModule. While I haven't actually tried it yet, I
> > believe this will work just fine. I can get to the request's
> > SoapContext object.
>
> You could use a policy instead.
Yes, I realize that. The customer will have the ability to add policy using
policy files. But the minimum requirement will always be that there should
be at least one SecurityToken.
> > However, for future plans, I would also want access to the
> > SoapEnvelope for that request. I have tried hooking into three
[quoted text clipped - 6 lines]
>
> But probaly you have to do something else ?
I'll look into implementing a filter for this. Thanks.
> Regards,
> Pierre
SA - 15 Dec 2004 17:40 GMT
Actually, it turns out that the Security.Tokens collection of that
SoapContext object I have access to is empty as well... (it's not Nothing,
just empty).
I am sure I am passing a security token, because if I put the check in a web
method, it works.

Signature
---
Sven.
> Hi all,
>
[quoted text clipped - 20 lines]
>
> Sven.
Dan Rogers - 16 Dec 2004 20:12 GMT
Hi,
yes, this also makes sense. In the HTTP module, no SOAP processing has
happened yet. The SoapContext stuff is filled in for you AFTER the stage
in the ASP pipeline where the HTTP module gets control. If you want to get
access to the payload data from the HTTP module, you need to crack the
input stream yourself.
I hope this helps
Dan Rogers
Microsoft Corporation
--------------------
From: "SA" <informatica@freemail.nl>
References: <#i#bfes4EHA.3908@TK2MSFTNGP12.phx.gbl>
Subject: Re: HttpModule not able to access SoapEnvelope
Date: Wed, 15 Dec 2004 11:40:01 -0600
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.224
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.224
Message-ID: <uVOf10s4EHA.2624@TK2MSFTNGP11.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices.enhancements
NNTP-Posting-Host: 65.82.123.186
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11
.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices.enhancements:5162
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices.enhancements
Actually, it turns out that the Security.Tokens collection of that
SoapContext object I have access to is empty as well... (it's not Nothing,
just empty).
I am sure I am passing a security token, because if I put the check in a web
method, it works.

Signature
---
Sven.
"SA" <informatica@freemail.nl> wrote in message
news:#i#bfes4EHA.3908@TK2MSFTNGP12.phx.gbl...
> Hi all,
>
[quoted text clipped - 5 lines]
>
> Instead of calling that function from every Soap Method, I want to put
this
> in an HttpModule. While I haven't actually tried it yet, I believe this
will
> work just fine. I can get to the request's SoapContext object.
>
> However, for future plans, I would also want access to the SoapEnvelope
for
> that request. I have tried hooking into three events: AUthenticateRequest,
> BeginRequest, and PreRequestHandlerExecute. In all of these events, the
[quoted text clipped - 7 lines]
>
> Sven.
Dan Rogers - 15 Dec 2004 17:42 GMT
In an HTTP module you have access to the request stream - and this contains
an HTTP request, which in turn contains an HTTP header and then a SOAP
request. You have to find the envelope yourself - since it hasn't been
pulled apart by the ASP.net stack yet.
I hope this helps
Dan Rogers
Microsoft Corporation
--------------------
From: "SA" <informatica@freemail.nl>
Subject: HttpModule not able to access SoapEnvelope
Date: Wed, 15 Dec 2004 11:00:02 -0600
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.224
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.224
Message-ID: <#i#bfes4EHA.3908@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices.enhancements
NNTP-Posting-Host: 65.82.123.185
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12
.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices.enhancements:5157
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices.enhancements
Hi all,
I want to ensure that my wSE 2.0 web service is being called with at least
one security token.
I have a function that validates that using the
RequestContext.Security.Tokens collection.
Instead of calling that function from every Soap Method, I want to put this
in an HttpModule. While I haven't actually tried it yet, I believe this will
work just fine. I can get to the request's SoapContext object.
However, for future plans, I would also want access to the SoapEnvelope for
that request. I have tried hooking into three events: AUthenticateRequest,
BeginRequest, and PreRequestHandlerExecute. In all of these events, the
Envelope property of my SoapContext is Nothing (null).
Is there a way I can access the Envelope in an HttpModule?
Thanks,
---
Sven.