2 Replies Latest reply on Feb 12, 2009 3:31 AM by gambellid

    schemavalidation: fault not returned to calling client

    ljgp

      Hi,

      I am using JBoss 4.2.2 and

      I was expecting that a schemavalidation error would by default be passed on to the client as a SOAP fault. I am observing that the exceptions show up in the app server logs, but that the client does not get any response (except for the header).

      I tried both without a custom error handler, and with my own handler, throwing an exception from handleError(). Both gave the same result: no output sent to the client.

      I must be missing something here, any help is appreciated.

      Cheers, Luc.

      The header is:

      HTTP/1.1 200 OK
      Date: Wed, 03 Sep 2008 10:03:33 GMT
      Content-Length: 0
      Content-Type: text/xml;charset=UTF-8
      X-Powered-By: Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)/Tomcat-5.5
      Server: Apache-Coyote/1.1

      In the logs it says:

      12:03:33,416 INFO [SOAPBodyElementDoc] Validating: XML_VALID
      12:03:33,447 ERROR [StrictlyValidErrorHandler] org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'Service'. One of '{Schema}' is expected.
      12:03:33,462 ERROR [RequestHandlerImpl] Error processing web service request
      org.jboss.ws.WSException: org.xml.sax.SAXException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'Service'. One of '{Schema}' is expected.
      at org.jboss.ws.WSException.rethrow(WSException.java:68)
      at org.jboss.ws.core.soap.SOAPBodyElementDoc.validatePayload(SOAPBodyElementDoc.java:130)
      at org.jboss.ws.core.soap.SOAPBodyElementDoc.transitionTo(SOAPBodyElementDoc.java:90)
      at org.jboss.ws.core.soap.SOAPContentElement.writeElement(SOAPContentElement.java:547)
      at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElementImpl.java:840)
      at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.java:825)
      at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElementImpl.java:840)
      at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.java:825)
      at org.jboss.ws.core.soap.SOAPElementWriter.writeElementInternal(SOAPElementWriter.java:149)
      at org.jboss.ws.core.soap.SOAPElementWriter.writeElement(SOAPElementWriter.java:130)
      at org.jboss.ws.core.soap.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:326)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.sendResponse(RequestHandlerImpl.java:392)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:321)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:201)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:134)
      at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

        • 1. Re: schemavalidation: fault not returned to calling client
          ljgp

          Hi,

          I think I understand now what is happening. When a schema validation occurs on an input message, the client that sent the incorrect message _does_ get the Soap fault. When the service itself constructs an XML reply that does not meet the schema requirements, the SaxException only ends up in the log and the client is left in the dark.

          Is this working as designed ?

          Cheers, Luc.

          • 2. Re: schemavalidation: fault not returned to calling client
            gambellid

            I have the same problem.
            Anyone know if this is the correct behavoiur and how is it possible to intercept the exception from the server side and send some fault code to the client?

            I'm searching over all forum but no solution is explained, help me please.

            Thanks