Hi, The error is definitely caused by mismatch of incoming response and generated JAXB classes using to unmarshall your response message. Could you double check your schema and generated jaxb classes? It will be helpful if you catch the response using TCP Monitor and validate it using your schema.
Regards, Andrei. From: Matheus Eduardo Bonifacio Morais [mailto:[email protected]] Sent: Dienstag, 19. Juli 2016 21:01 To: [email protected] Subject: Understanding one Unmarshalling Error Hello! It has been an while since I was trying to understand one unmarshalling error in CXF that I'm getting. Right now I have no idea on why it happen so I hope one of you on this list could help me to find the cause of the problem. I'm using the fantastic and simple TomEE (7.0.0) for my application and AFAIK it uses Apache CXF 3.1.6. My application uses WS/SOAP and we I run on specific method I receive the following error: org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element (uri:"", local:"cpfConjuge"). Expected elements are <{}nroDocumento>,<{}nomMae>,<{}nomAssociado>,<{}datNascimento>,<{}tpoTitularidade>,<{}codUF>,<{}tpoDocumento>,<{}nomCidade>,<{}oidPessoa> 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:109) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1670) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1551) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:651) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139) at com.sun.proxy.$Proxy193.consultarDadosAssociado(Unknown Source) at br.com.sicredi.gestao.restritivos.application.acesso.CadastroAssociadoAcesso.consultarDadosAssociado(CadastroAssociadoAcesso.java:58) at br.com.sicredi.gestao.restritivos.application.ejb.FachadaRestritivosService.consultaOidPessoa(FachadaRestritivosService.java:1440) at br.com.sicredi.gestao.restritivos.application.ejb.FachadaRestritivosService.buscarScoreMaiorSeveridade(FachadaRestritivosService.java:1492) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205) at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186) at org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181) at org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205) at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186) at org.apache.openejb.server.cxf.ejb.EjbMethodInvoker.performInvocation(EjbMethodInvoker.java:92) at org.apache.openejb.server.cxf.ejb.EjbMethodInvoker.directEjbInvoke(EjbMethodInvoker.java:204) at org.apache.openejb.server.cxf.ejb.EjbInterceptor.intercept(EjbInterceptor.java:90) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205) at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186) at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:97) at org.apache.openejb.core.stateless.StatelessContainer.invokeWebService(StatelessContainer.java:307) at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:231) at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:203) at org.apache.openejb.server.cxf.ejb.EjbMethodInvoker.preEjbInvoke(EjbMethodInvoker.java:125) at org.apache.openejb.server.cxf.ejb.EjbMethodInvoker.invoke(EjbMethodInvoker.java:82) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:74) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126) at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131) 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.openejb.server.cxf.CxfWsContainer.onMessage(CxfWsContainer.java:85) at org.apache.openejb.server.webservices.WsServlet.service(WsServlet.java:98) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1102) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:788) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1485) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: javax.xml.bind.UnmarshalException - with linked exception: [com.sun.istack.internal.SAXParseException2; lineNumber: 1; columnNumber: 282; unexpected element (uri:"", local:"cpfConjuge"). Expected elements are <{}nroDocumento>,<{}nomMae>,<{}nomAssociado>,<{}datNascimento>,<{}tpoTitularidade>,<{}codUF>,<{}tpoDocumento>,<{}nomCidade>,<{}oidPessoa>] at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:420) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:357) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:334) 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) ... 80 more Caused by: com.sun.istack.internal.SAXParseException2; lineNumber: 1; columnNumber: 282; unexpected element (uri:"", local:"cpfConjuge"). Expected elements are <{}nroDocumento>,<{}nomMae>,<{}nomAssociado>,<{}datNascimento>,<{}tpoTitularidade>,<{}codUF>,<{}tpoDocumento>,<{}nomCidade>,<{}oidPessoa> at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:697) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:243) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:238) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:105) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.childElement(Loader.java:90) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StructureLoader.childElement(StructureLoader.java:236) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:534) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:516) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:231) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:165) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:355) ... 86 more As you can see the problem seems in "cfpConjuge" element but it is defined in XSD of the service that my application is calling. My application call one method called consultarDadosAssociado which returns one element "cpfConjuge". I'm attaching the XSD and the WSDL so you can check this. Can someone help me to understand why that error happen and if this could be a bug on CXF? Thanks! Matheus Morais ________________________________ Esta mensagem é somente para uso do destinatário informado e pode conter informações privilegiadas, proprietárias, ou privadas. Se você recebeu esta mensagem por engano, por favor notifique o remetente imediatamente e apague a original. Qualquer uso deste email é proibido. This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.
