[jboss-user] [JBossWS] - Re: Schema Validation in JBOSS-WS

ngtdave do-not-reply at jboss.com
Mon Feb 18 09:40:09 EST 2008

I built a little validation piece for our WS, if anyone is interested. It's not as cool as it could be if it was built in, but it works.  I did it using the validation stuff from xmlbeans and a Handler which extends the GenericSOAPHandler.

The key was to separate the elements to be validated from the WSDL stuff.
So I have 1 WSDL with all the , , , , and  stuff in it. But the contents of each of those refer to elements defined in XSDs. The WSDL refers to one XSD which has all the top level operations and parameters defined. That XSD then refers to many other XSDs which have more details. So basically all the stuff to validate resides in XSDs, of which, there is 1 top level XSD referred to by the WSDL. 

In my handler, I get the top level xsd from the context and load/compile it using XmlBeans.compileXsd(). Then on each message (handleInbound) I extract the SOAPBody, get the first text node (The payload of the request) and validate it with the compiled schema.  

The validation errors coming from xmlbeans aren't always the nicest, but nothing gets through which is invalid. :)

If anyone is interested I could probably dummy up a very simple example and post it.

Hope this helps anyone who needs validation.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4130127#4130127

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4130127

More information about the jboss-user mailing list