Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

SchemaValidationFeature doesn't validate the contents of the SOAP header  RSS feed

 
Ranch Hand
Posts: 158
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Use a handler on the client side to access and validate the header.
Best wishes!
 
Ravi Danum
Ranch Hand
Posts: 158
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan,

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

Thanks.

Ravi
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 158
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!