3

What I want is to decorate my data contracts with few attributes (e.g. min,max, string length etc.) and get the XML schema generated for my SOAP (non .net) clients. After some research on internet, I have come across the following article:

http://wcfsecurity.codeplex.com/wikipage?title=How%20To%20-%20Perform%20Message%20Validation%20with%20Schemas%20in%20WCF

This seems to be pretty manual to me. I am after some more decent solution and out of the box functionality. With WCF offering so much, I will be surprised if it has missed this whole concept of SOAP standard validation.

Any help on this will be much appreciated.

1 Answers1

4

The XML schemas for the DataContract objects are found in the WSDL for the service. WCF does not explicitly validate soap messages against these schemas for a number of reasons. First, the process of deserializing soap messages, in effect, performs validation based on the DataContract or XML serialization defined on the data classes. Next, there is a definite performance hit if every soap message was being validated against the XML schemas. Lastly, WCF supports soap message versioning for both forward and backward compatibility through the IExtensibleDataObject optional interface capability. To do this, XML schema validation would most likely be too strict.

SliverNinja - MSFT
  • 31,051
  • 11
  • 110
  • 173
Sixto Saez
  • 12,610
  • 5
  • 43
  • 51
  • 1
    I am not after the validation, but the generation of the WSDL including the validation attributes such as – Satjinder Singh Bath Mar 30 '12 at 03:21
  • 1
    Sounds like you sound look at the WCF [custom metadata](http://msdn.microsoft.com/en-us/library/ms731213.aspx) extension. That allows you to manipulate the generated WSDL pretty much in any way you need. – Sixto Saez Mar 30 '12 at 14:48