After reading about a 1/2 dozen posts from people indicating that their validate service always returns true and not finding any answers I decided to test it myself see what I could come up with (ok, so i had the same problem and was actually just trying to resolve it).
I’ve found that the following two scenarios cause the pub.schema:validate service to always return true (IS 6.1):
Make sure your xmlData input begins with the header “<?xml version="1.0"?>”. If you pass in an XML Node without the header the service always returnes true. I ran into this problem because I was calling soap.util:getBody service and passing that XML Node into the validate service. I had to add a MAP step to append the xml version tag to make the validate service work properly.
If your XSD file defines a target namespace, make sure the XML root node you’re validating is prefixed and declares the same namespace. If it’s prefixed and declares the wrong namespace, the service returns an error, which is OK. If it has no prefix or namespace, for example:
[highlight=xml]<?xml version="1.0"?> 123 34sdf sdf2 [/highlight] but the XSD Schema declares a namespace the service returns true. I would have expected the validate service to return a "Unable to locate a matching element declaration" as it does if you specify the wrong namespace.
Hope this helps and if anyone can explain this behavior, or a mistake that I’ve made please do!