You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Daniel Kulp <dk...@apache.org> on 2018/06/01 17:41:03 UTC

Re: CXF Unmarshalling Error while unmarshalling SOAP request with date input if it is empty


> On May 31, 2018, at 2:50 PM, mmugabo <ma...@gmail.com> wrote:
> 
> Hello out there, 
> I am having an issue with CXF failing to unmarshall my soap request if the
> date input is empty, here is the info and the error, any help is very much
> appreciate:

Well, if the type in the schema is xsd:date or similar, then that is an invalid soap message.   xsd:date would not allow for an empty element.   JAXB is trying to parse the contents of the element as a date since that is exactly what is supposed to be there, but the parsing is failing.


Dan




> 
> Apache CXF version: *3.1.7*
> Error comes from "*cxf-rt-databinding-jaxb*" which of course is version
> *3.1.7*
> My SOAP request has a section like this: The problem is with the
> "*EffectiveStartDate*" field.
> -----------------------------------------
> <inb:Order>
>                  <inb:OrderNumber>XYZ1234</inb:OrderNumber>
>                  <inb:OrderLineItems>
>                     <inb:OrderLineItem OrderLineItemNumber="1">
>                        /*<inb:EffectiveStartDate/>*/
>                     </inb:OrderLineItem>
>                  </inb:OrderLineItems>
>               </inb:Order>
> ------------------------------------------------
> 
> The error I get is below:
> 
> 
> org.apache.cxf.interceptor.Fault: Unmarshalling Error:  
> 	at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:905)
> 	at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:712)
> 	at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:179)
> 	at
> org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:194)
> 	at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> 	at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
> 	at
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:254)
> 	at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:234)
> 	at
> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
> 	at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1129)
> 	at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1065)
> 	at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
> 	at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
> 	at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
> 	at org.eclipse.jetty.server.Server.handle(Server.java:499)
> 	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
> 	at
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
> 	at
> org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
> 	at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
> 	at
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
> 	at java.lang.Thread.run(Thread.java:745)
> Caused by: javax.xml.bind.UnmarshalException
> - with linked exception:
> [com.sun.istack.SAXParseException2; lineNumber: 0; columnNumber: 0; ]
> 	at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:483)
> 	at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:417)
> 	at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:394)
> 	at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.doUnmarshal(JAXBEncoderDecoder.java:855)
> 	at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.access$100(JAXBEncoderDecoder.java:102)
> 	at
> org.apache.cxf.jaxb.JAXBEncoderDecoder$2.run(JAXBEncoderDecoder.java:894)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:892)
> 	... 20 more
> Caused by: com.sun.istack.SAXParseException2; lineNumber: 0; columnNumber:
> 0; 
> 	at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:740)
> 	at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:770)
> 	at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:766)
> 	at
> com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$12.parse(RuntimeBuiltinLeafInfoImpl.java:595)
> 	at
> com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$12.parse(RuntimeBuiltinLeafInfoImpl.java:568)
> 	at
> com.sun.xml.bind.v2.runtime.FilterTransducer.parse(FilterTransducer.java:84)
> 	at
> com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:245)
> 	at
> com.sun.xml.bind.v2.runtime.unmarshaller.LeafPropertyLoader.text(LeafPropertyLoader.java:65)
> 	at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.text(UnmarshallingContext.java:589)
> 	at
> com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.text(InterningXmlVisitor.java:93)
> 	at
> com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.processText(StAXStreamConnector.java:338)
> 	at
> com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleEndElement(StAXStreamConnector.java:216)
> 	at
> com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:185)
> 	at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:415)
> 	... 26 more
> 
> 
> 
> --
> Sent from: http://cxf.547215.n5.nabble.com/cxf-dev-f569328.html

-- 
Daniel Kulp
dkulp@apache.org <ma...@apache.org> - http://dankulp.com/blog <http://dankulp.com/blog>
Talend Community Coder - http://coders.talend.com <http://coders.talend.com/>

Re: CXF Unmarshalling Error while unmarshalling SOAP request with date input if it is empty

Posted by mmugabo <ma...@gmail.com>.
Hi Daniel,
Thanks for your reply, yes that is true, here is the type in my wsdl file:
<xs:element minOccurs="0" name="EffectiveStartDate" type="xs:date"/>

And I think you are right, it must be an invalid soap message. However, my
options are limited to find a walk around here, since, the API am working on
is supposed to replace some legacy system and the task is, no client would
have to change anything on their end (including obviously, sending a valid
soap here). The legacy must have a way to deal with this but unfortunately I
can't see what they are doing in this scenario. Any suggestions here? I see
this issue online, other ppl came across, but no answer, is it possible the
latest cxf version might have implemented a walk around?
Thanks




--
Sent from: http://cxf.547215.n5.nabble.com/cxf-dev-f569328.html