This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Web Services and the fly likes validating soap response Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "validating soap response" Watch "validating soap response" New topic
Author

validating soap response

gaurav abbi
Ranch Hand

Joined: Jan 05, 2007
Posts: 108
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
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
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.


Android appsImageJ pluginsJava web charts
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
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


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: validating soap response
 
Similar Threads
SchemaValidationFeature doesn't validate the contents of the SOAP header
XML Schema Validation
Axis stubs not validating properly
WebSphere webservice
What does this mean: "Required white space was missing"