![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 |
| | #2 (permalink) |
| 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 |