0 Replies Latest reply on Jun 24, 2010 3:31 PM by Martin Sarabura

    Validation of incoming document

    Martin Sarabura Newbie

      I almost got JBoss Ws (native) to validate schemas but have encountered a problem.

      Bit of background: I am using top-down wsdl, wrapped document/literal convention. JBoss WS v 3.2.2GA deployed to JBoss 5.1.0. Earlier I had trouble validating the schema because I referenced the wsdl document in my schema validation annotation. Thus

       

      @SchemaValidation(enabled=true, schemaLocation="Integrity_2010.wsdl")

      gives you the error "definitions should not be the root element in a schema document". So instead I tried

       

      @SchemaValidation(enabled=true, schemaLocation="Integrity_2010.xsd")

      and I split out the schema into the xsd document. Now the schema validation doesn't complain when you deploy the web service to the server. However, when I invoke a web service I get this error:

       

      org.xml.sax.SAXException: cvc-elt.1: Cannot find the declaration of element 'int:createItem'.

       

      where createItem is one of my wsdl operations. The xmlns:int namespace is the wsdl target namespace and using wrapped document literal it needs to be the root of the xml payload. For example:

       

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:int="http://webservice.mks.com/2010/Integrity"
        xmlns:sch="http://webservice.mks.com/2010/Integrity/schema">
         <soapenv:Header/>
         <soapenv:Body>
            <int:createItem>
               <arg0 transactionId="test">
                  <sch:ItemField Name="Summary">
                     <sch:longtext>This is a test</sch:longtext>
                  </sch:ItemField>
               </arg0>
            </int:createItem>
         </soapenv:Body>
      </soapenv:Envelope>

      So here's the dilemma: I can't validate the schema because the root of the payload is in a different namespace than the one I am validating. On the other hand, if I declare the element to be in the schema namespace then I am no longer using the wrapped document literal convention and I get the error

       

      Endpoint {http://webservice.mks.com/2010/Integrity}Integrity_2010Port does not contain operation meta data for: {http://webservice.mks.com/2010/Integrity/schema}createItem

       

      so it doesn't work at all.

       

      So here's the question: Has anybody successfully validated wrapped document/literal documents using native JBoss WS?

      How about one of the other stacks (CXF, Metro)?