Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

schema validating an incoming message

 
 
Thread Tools Display Modes
Old 03-04-2006   #1 (permalink)
Damon Allison
Guest


 

schema validating an incoming message

All,

I would like to schema validate an incoming message before I process it
w/ indigo. If the message is not schema valid, I would like to send
back an exception to the caller. If the message is valid, it processes
normally.

I have created a service that accepts and returns generic
System.ServiceModel.Message objects. This gives me total control of the
message contents, however it also bypasses the automatic serialization
and makes the contract really generic. You cannot generate objects via
svcutil since everything is a basic message.

Are there any other hooks within Indigo that I can use to run schema
validation as the message arrives, perhaps the Channel provides something?

Thanks,
Damon




<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)> _
Public Class EventsService6
Implements IEventsService6

Private m_events As New List(Of LinkItemSer)

Public Function GetEvent(ByVal msg As Message) As Message
Implements IEventsService6.GetEvent
Console.WriteLine("EventsService6.GetEvent()")

Dim key As String = msg.Headers.GetHeader(Of
String)("LicenseKeyHeader", "http://chr/2006/02/EventsService6")
Console.WriteLine("License key is " & key)
Return New GetEventsResponse(m_events)

End Function
Old 03-04-2006   #2 (permalink)
Clemens Vasters [MSFT]
Guest


 

Re: schema validating an incoming message

You may want to implement an IStubMessageInspector (server-side) or
IProxyMessageInspector (client-side) behavior.

These are installed by creating an Attribute implementing IContractBehavior
and adding to the MessageInspectors collection of the DispatchBehavior or
ProxyBehavior you'' get through the respective methods.

If you want to throw exceptions (like "validation failed") from within the
server side behavior, you must also implement IErrorHandler in the behavior
and map exceptions to faults. The hook is in DispatchBehavior.ErrorHandlers.
On the client side you can throw without mapping to faults.

clemens vasters | program manager
windows communication foundation

microsoft corporation
clemensv@microsoft.com



"Damon Allison" <dallison@no-spam.vis.cc> wrote in message
news:%23WMuKxNKGHA.604@TK2MSFTNGP14.phx.gbl...
> All,
>
> I would like to schema validate an incoming message before I process it w/
> indigo. If the message is not schema valid, I would like to send back an
> exception to the caller. If the message is valid, it processes normally.
>
> I have created a service that accepts and returns generic
> System.ServiceModel.Message objects. This gives me total control of the
> message contents, however it also bypasses the automatic serialization and
> makes the contract really generic. You cannot generate objects via
> svcutil since everything is a basic message.
>
> Are there any other hooks within Indigo that I can use to run schema
> validation as the message arrives, perhaps the Channel provides something?
>
> Thanks,
> Damon
>
>
>
>
> <ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)> _
> Public Class EventsService6
> Implements IEventsService6
>
> Private m_events As New List(Of LinkItemSer)
>
> Public Function GetEvent(ByVal msg As Message) As Message
> Implements IEventsService6.GetEvent
> Console.WriteLine("EventsService6.GetEvent()")
>
> Dim key As String = msg.Headers.GetHeader(Of
> String)("LicenseKeyHeader", "http://chr/2006/02/EventsService6")
> Console.WriteLine("License key is " & key)
> Return New GetEventsResponse(m_events)
>
> End Function



 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic reply to incoming message Jack Vista mail 6 05-04-2008 04:57 PM
Edit-->Copy from incoming message text doesn't always work. Bryan Live Mail 1 04-03-2008 04:04 PM
Sent emails & Message Rules for incoming Mail Peter Falconer Vista mail 7 06-29-2007 09:13 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50