2 // TimestampInputFilter.cs: Timestamp SOAP Input Filter
5 // Sebastien Pouliot (spouliot@motus.com)
7 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
9 // Licensed under MIT X11 (see LICENSE) with this specific addition:
11 // “This source code may incorporate intellectual property owned by Microsoft
12 // Corporation. Our provision of this source code does not include any licenses
13 // or any other rights to you under any Microsoft intellectual property. If you
14 // would like a license from Microsoft (e.g. rebrand, redistribute), you need
15 // to contact Microsoft directly.”
21 namespace Microsoft
.Web
.Services
.Timestamp
{
24 // 1. Inside the Web Services Enhancements Pipeline
25 // http://msdn.microsoft.com/library/en-us/dnwebsrv/html/insidewsepipe.asp
27 public class TimestampInputFilter
: SoapInputFilter
{
29 public TimestampInputFilter () {}
31 public override void ProcessMessage (SoapEnvelope envelope
)
34 throw new ArgumentNullException ("envelope");
36 if (envelope
.Header
!= null) {
37 XmlNodeList xnl
= envelope
.Header
.GetElementsByTagName (WSTimestamp
.ElementNames
.Timestamp
, WSTimestamp
.NamespaceURI
);
38 if ((xnl
!= null) && (xnl
.Count
> 0)) {
39 XmlElement xel
= (XmlElement
) xnl
[0];
40 envelope
.Context
.Timestamp
.LoadXml (xel
);
41 if (envelope
.Context
.Timestamp
.Expires
< DateTime
.UtcNow
)
42 throw new TimestampFault ("Message Expired", null);
43 envelope
.Header
.RemoveChild (xel
);