Announcement Announcement Module
Collapse
No announcement yet.
MTOM and XML validation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MTOM and XML validation

    Hi,

    i switched from a SWS M3 release to the RC2 release.
    I have a problem now with my WebService, which transfers files.

    The last months, i simply used a simple base64binary field to upload and download small files.

    The new SWS RC2 version has MTOM support, which is very fine, but causes problems.
    It seems that MTOM is automatically used for base64binary array fields. The problem is, that MTOM adds a child to the field which is a reference to the attachment. But the XSD says, that the field doesn't have a child. I think that's why i get this error.
    Code:
    4678053 [http-8080-Processor24] DEBUG endpoints.EIMServiceExecuteEndpoint  - Marshalling [de.cas.eim.wsdl.business.ExecuteResponse@181bd26] to response payload
    4678068 [http-8080-Processor24] INFO  exceptionresolver.ExceptionMappingDirector  - No direct mapping of exception possible.
    4678068 [http-8080-Processor24] WARN  exceptionresolver.ExceptionMappingDirector  - An exception has occured, which has no suitable mapping at all. This means a lost of exception information. Exception was:org.springframework.oxm.jaxb.JaxbMarshallingFailureExceptionJAXB marshalling exception: null; nested exception is javax.xml.bind.MarshalException
     - with linked exception:
    [org.xml.sax.SAXParseException: cvc-type.3.1.2: Element 'ns4:documentContent' is a simple type, so it must have no element information item [children].]
    4678084 [http-8080-Processor24] DEBUG exceptionresolver.EIMSoapFaultMappingExceptionResolver  - adding server fault to soap body
    4678084 [http-8080-Processor24] WARN  server.SoapMessageDispatcher  - Endpoint invocation resulted in exception - responding with SOAP Fault
    org.springframework.oxm.jaxb.JaxbMarshallingFailureException: JAXB marshalling exception: null; nested exception is javax.xml.bind.MarshalException
     - with linked exception:
    [org.xml.sax.SAXParseException: cvc-type.3.1.2: Element 'ns4:documentContent' is a simple type, so it must have no element information item [children].]
    Caused by: 
    javax.xml.bind.MarshalException
     - with linked exception:
    [org.xml.sax.SAXParseException: cvc-type.3.1.2: Element 'ns4:documentContent' is a simple type, so it must have no element information item [children].]
    	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:304)
    	at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:230)
    	at org.springframework.oxm.jaxb.Jaxb2Marshaller.marshal(Jaxb2Marshaller.java:272)
    	at org.springframework.ws.server.endpoint.support.MarshallingUtils.marshal(MarshallingUtils.java:72)
    	at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.marshalResponse(AbstractMarshallingPayloadEndpoint.java:149)
    	at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.invoke(AbstractMarshallingPayloadEndpoint.java:133)
    	at org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter.invoke(MessageEndpointAdapter.java:40)
    	at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:210)
    	at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:157)
    	at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:86)
    	at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:56)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:806)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:736)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:360)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    	at java.lang.Thread.run(Thread.java:595)
    Caused by: org.xml.sax.SAXParseException: cvc-type.3.1.2: Element 'ns4:documentContent' is a simple type, so it must have no element information item [children].
    	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    	at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
    	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    	at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
    	at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
    	at org.apache.xerces.impl.xs.XMLSchemaValidator.elementLocallyValidType(Unknown Source)
    	at org.apache.xerces.impl.xs.XMLSchemaValidator.processElementContent(Unknown Source)
    	at org.apache.xerces.impl.xs.XMLSchemaValidator.handleEndElement(Unknown Source)
    	at org.apache.xerces.impl.xs.XMLSchemaValidator.endElement(Unknown Source)
    	at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.endElement(Unknown Source)
    	at org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)
    	at com.sun.xml.bind.v2.runtime.output.SAXOutput.endTag(SAXOutput.java:84)
    	at com.sun.xml.bind.v2.runtime.output.XmlOutputAbstractImpl.endTag(XmlOutputAbstractImpl.java:84)
    	at com.sun.xml.bind.v2.runtime.output.ForkXmlOutput.endTag(ForkXmlOutput.java:51)
    	at com.sun.xml.bind.v2.runtime.output.MTOMXmlOutput.endTag(MTOMXmlOutput.java:69)
    	at com.sun.xml.bind.v2.runtime.XMLSerializer.leafElement(XMLSerializer.java:324)
    	at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$PcdataImpl.writeLeafElement(RuntimeBuiltinLeafInfoImpl.java:140)
    	at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.writeLeafElement(TransducedAccessor.java:214)
    	at com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty.serializeBody(SingleElementLeafProperty.java:62)
    	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:286)
    	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:663)
    	at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:113)
    	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:286)
    	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:571)
    	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:276)
    	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:472)
    	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:301)
    	... 30 more
    If i change the field type from base64binary to hexBinary, MTOM is not used and it works again. Is this already a bug, because the behavior is different?

    Is it possible that i can never validate my incoming or outgoing xml if MTOM is used? How can i validate MTOM-enabled WebService-Messages?

    Cheers,

    Ingo

  • #2
    I think this is more of a JAXB2 issue than a SWS issue,since this just using JAXB2's MTOM support. The question is: can JAXB2 marshal to hexBinary? And I don't know the answer to that...

    Comment


    • #3
      I didn't get a response yet in the JAXB-Mailinglist. But it's possible, that JAXB-MTOM can't marshal hexBinary.

      But what's with the other question. Do you have a answer for a little guy like me?
      Is it possible that i can never validate my incoming or outgoing xml if MTOM is used? How can i validate MTOM-enabled WebService-Messages?

      Comment


      • #4
        Since validation is defined at the endpoint mapping level, you can define one mapping that contains all the MTOM endpoints, and disable validation on that one. All the non-MTOM endpoints can simply go in another endpoint, with validation.

        Comment

        Working...
        X