• Post Reply Bookmark Topic Watch Topic
  • New Topic

validating soap response

 
gaurav abbi
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

javax.xml.validation example
Using the Validating Parser

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.

Loosely typed versus strongly typed Web services
Tip: xsd:any: A cautionary tale
Realizing Strategies for Document-Based Web Services With JAX-WS 2.0: Part 3 in a Series
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!