Message validation with Schema in WCF

后端 未结 1 531
鱼传尺愫
鱼传尺愫 2021-01-21 03:47

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 r

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-21 04:42

    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.

    0 讨论(0)
提交回复
热议问题