Yesterday, at the end of Scott's
talk, someone asked whether the ASP.NET Web Services Infrastructure did Schema validation
of incoming SOAP Messages according to the schema defined in the WSDL types section
(or imported schemas in the WSDL). I happen to think this is a pretty interesting
question, actually. My first reaction was to say "No, it doesn't" (ok, I actually
went ahead and said it). But then, Chris
Brooks said something that left me thinking. He agreed it didn't actually do validation,
but some sort of check was done, in the sense that if your WebMethod's code executed,
then something about the incoming message was right: it was enough for the XmlSerializer
to reconstruct the WebMethod arguments and do the call.
I thought this was an interesting idea. Certainly, one could consider
this some sort of very light, very superficial validation. But perhaps "Schema Conformance"
would be a better term: One could say that the incoming message "conforms" to the
specified schema, in the sense that there is a one-way transformation that can be
done from the incoming data to the WebMethod's arguments. That transformation will
possibly include taking advantage of nullable types (in this case, I actually mean
passing null for a reference type-argument), default values for value types, etc.
It's actually much more interesting if you even consider that some
specific types can "conform" to almost any possible schema representing the expected
incoming message schema, such as XmlNode.
PS: I'm writing this as I watch Clemens talk
about his Aspect Oriented Work :)