• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SchemaValidationFeature doesn't validate the contents of the SOAP header

 
Ranch Hand
Posts: 165
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 165
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 165
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
A teeny tiny vulgar attempt to get you to buy our stuff
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic