users@jax-ws.java.net

MTOM and XML validation

From: Ingo Siebert <ingo.siebert_at_cas.de>
Date: Fri, 22 Jun 2007 08:22:56 +0200

Hi,

i'm using Spring-WS RC2 (server-side) and JAX-WS 2.1(server + test client).

I have a problem with my WebService, which transfers small files.

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

The new Spring-WS RC2 version has MTOM support, which is very fine, but
causes problems.
It seems that MTOM is automatically used for base64binary array fields.

My assumption of the problem is that MTOM(JAX-WS) 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 validation
error(i validate all incoming and outgoing messages against my XSD).

If i change the field type from base64binary to hexBinary, MTOM is not
used and it works again. Is this 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

-- 
The stack trace:
4678053 [http-8080-Processor24] DEBUG 
endpoints.EIMServiceExecuteEndpoint  - Marshalling 
[de.cas.eim.wsdl.business.ExecuteResponse_at_181bd26] to response payload
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