Schema validation

Topics: General Discussion Forum
Jan 29, 2007 at 10:10 AM
I was wondering if anyone had any neat ways of doing this? By default the request message isn't validated which seems a bit of a shame as I have generated my message formats from a number of schemas which specify the acceptable format. Can anyone help please? Thanks.

Jan 30, 2007 at 6:44 PM
You may have a couple of alternatives here. First, you can take a look at WSSF reference implementation sample application and see how we implemented message validation using a generic API (Message validation) that make use of parameter inspectors to enforce validation rules on each operation parameter and operation wide validation as well. The advantage of this validation strategy (regex validation over schema) basically gives you better control on some scenarios like co-occurrence constraints that may not be expressed with W3C XML Schema.

However, if you already have your model designed with schema validation in mind, then I will recommend you the WCF samples that come with the .NET 3.0 SDK ( There you will find in “Samples\TechnologySamples\Extensibility\MessageInspectors” a nice sample that shows how to use message validation with schemas using the message inspector feature (using an endpoint behavior) that IMO fits quite well this scenario.

Hope this help you,