aspose file tools*
The moose likes Web Services and the fly likes SchemaValidationFeature doesn't validate the contents of the SOAP header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "SchemaValidationFeature doesn Watch "SchemaValidationFeature doesn New topic
Author

SchemaValidationFeature doesn't validate the contents of the SOAP header

Ravi Danum
Ranch Hand

Joined: Jan 13, 2009
Posts: 104
Hello,

I am using com.sun.xml.ws.developer.SchemaValidationFeature to provide schema validation on the client side.

This validates the SOAP body but it doesn't validate the SOAP header.

How can I get it to validate the SOAP header?

Thank you very much for your attention.

Ravi
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Use a handler on the client side to access and validate the header.
Best wishes!
Ravi Danum
Ranch Hand

Joined: Jan 13, 2009
Posts: 104
Hi Ivan,

Thanks, that makes sense. What validator would you recommend to validate the header from the handler?

Thanks.

Ravi
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
If you are only going to validate the header, I would use StAX or SAX.
Both these alternatives are fast and uses less memory.
Best wishes!
Ravi Danum
Ranch Hand

Joined: Jan 13, 2009
Posts: 104
Hi Ivan and All,

I have run further testing and it looks like the SchemaValidationFeature validates the SOAP body fine and also the SOAP header to some degree. The problem is that within the SOAP header, if a field is mandatory and is left blank, it is not flagged by the SchemaValidationFeature. It seems to pick out mandatory fields being left blank just fine in the SOAP body though. The header is a different xsd from the body xsd. I have checked both xsds and don't see differences that would cause this problem.

Do I need something extra than minOccurs="1" maxOccurs="1" to specify that a field is mandatory?

Thanks.

-Paula

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hello!
Validate SOAP headers to some degree?!??
That sounds interesting - if you ask me, they are either validated or not validated. I would not trust partial validation.
Yes, if you want to make a field mandatory in an XML schema, you can use minOccurs"1".
Best wishes!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SchemaValidationFeature doesn't validate the contents of the SOAP header