5 Replies Latest reply on Feb 29, 2008 11:10 AM by ngtdave

    Schema Validation in JBOSS-WS

    king_country2000


      I am trying to use JBOSSWS 1.0.2. and JBOSSAS-4.0.4GA


      I am starting with a WSDL file that contains a schema. I used WSTOOLS to generate the appropriate artifacts

      I would like to use DOCUMENT/LITERAL wrapped style and I would like to turn on schema validation of my XML instances against a schema defined in the WSDL (on receipt of the message the server does the validation ?).

      Looking through the sources, I see that JAXBDeserializer (jbossws-core.jar) calls JAXBUnmarshallerImpl which calls UnmarshallerImpl (jboss-xml-binding.jar) which does the parsing of the XML.

      I do not see any call to UnmarshallerImpl.setSchemaValidation in this call graph. Should this be called to turn on to do Schema Validation ? If so how and where ?


      Is Schema Validation for Document/Literal something that JBOSSWS 1.0.2 supports ?

      How does one turn on XML Schema validation in JBOSSWS ?

      Thanks for any help

      Srinivas

        • 1. Re: Schema Validation in JBOSS-WS
          thomas.diesler
          • 2. Re: Schema Validation in JBOSS-WS
            jthalliley

            We were counting on the JBoss WS stack to validate incoming data against our schemas :-(

            Guess I'm putting in my vote to increase the priority of this item.


            Thanks,
            Tom

            • 3. Re: Schema Validation in JBOSS-WS

              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.

              • 4. Re: Schema Validation in JBOSS-WS
                ripper64

                I need to do this as well. I would like to see your example.

                Thanks
                Jeff

                • 5. Re: Schema Validation in JBOSS-WS

                  It looks like Mr. Diesler has put some good information in the bug http://jira.jboss.org/jira/browse/JBWS-1172 on how to do this, probably better than the implementation I built. It also looks like he is starting to develop it, so you might just wait to see his implementation.