i need to validate soap response, tried googling for that, but mostly .net links availabale. can anybody provide some pointers to it or the strategy one should follow, like should i go for a schema kind of validation or there are other options. if its a schema type validation, should we use only standard schemas or they can be modified.
thanks,<br />gaurav abbi
Joined: Mar 22, 2005
What kinds of validations are you thinking of? If the response is not well-formed SOAP, then the SOAP engine will throw an exception anyway.
Originally posted by gaurav abbi: if its a schema type validation, should we use only standard schemas or they can be modified.
An XML Schema aware parser can validate XML against standard schemas or your own schemas.
For performance reasons many web services toolkits don't support automatic validation that can simply be turned on. For non-document-oriented web services the toolkit will generate the (un)marshalling code which will detect many errors anyway. And for document-oriented web services the resulting XML document can be validated by the usual means.
Some XML parsers will let you validate against a DTD, however SOAP web services use XML Schema inside the definition/description of the service contract with WSDL, so XML schema is usually used for validation as well.
It isn't uncommon for responses that are generated within you own trust boundaries (usually the intra-net) to go un-validated as validation can decrease performance. Requests/Responses that originate from outside of your trust boundaries should be validated however.
XML Schema supports the "any" and "anyType" which will accept any well formed XML. These are sometimes useful - however they can complicate the validation process as it becomes necessary to classify the content before either validating it separately or selecting the correct (more restrictive) schema for validation.