Hi Steve,
The schema and message are somewhat garbled, but judging from the error
message the problem is that the response has a namespace for the id
element (and presumably others) while your code expects this not to have
a namespace. It looks like the schema matches your code, since it does
not specify elementFormDefault='qualified' and without this child
elements do not use namespaces.
- Dennis
Dennis M. Sosnoski
Java SOA and Web Services Consulting <http://www.sosnoski.com/consult.html>
CXF and Web Services Security Training
<http://www.sosnoski.com/training.html>
Web Services Jump-Start <http://www.sosnoski.com/jumpstart.html>
On 05/11/2012 10:45 AM, Steve Kim wrote:
I'm getting the exception while it's parsing the response from 3rd party as
below: Can someone please help as this is very critical failure on our service?
Thanks for your time
org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for
{http://xxx.com/binders/general/2010/1/1}BinderServiceService#{http://xxxx.com/binders/general/2010/1/1}processRequest
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element
(uri:"http://xxx.com/common/general/2010/1/1/platformServiceResult", local:"id"). Expected elements
are<{}id>,<{}information>,<{}systemMessageNumber>,<{}status>,<{}newToken>,<{}systemMessage>,<{}systemId>,<{}parameters>
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(
at org.apache.cxf.jaxb.io.DataReaderImpl.read(
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
at org.apache.cxf.endpoint.ClientImpl.onMessage(
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(
at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(
at org.apache.cxf.io.CachedOutputStream.close(
at org.apache.cxf.transport.AbstractConduit.close(
at org.apache.cxf.transport.http.HTTPConduit.close(
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
at org.apache.cxf.endpoint.ClientImpl.doInvoke(
at org.apache.cxf.endpoint.ClientImpl.invoke(
at org.apache.cxf.endpoint.ClientImpl.invoke(
at org.apache.cxf.endpoint.ClientImpl.invoke(
at org.apache.cxf.frontend.ClientProxy.invokeSync(
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(
at $Proxy69.processRequest(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
......
at org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(
at
org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(
at
org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(
at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(
at org.springframework.test.context.junit4.SpringMethodRoadie.run(
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(
at org.junit.internal.runners.JUnit4ClassRunner$1.run(
at org.junit.internal.runners.ClassRoadie.runUnprotected(
at org.junit.internal.runners.ClassRoadie.runProtected(
at
org.junit.internal.runners.JUnit4ClassRunner.run(JAXBEncoderDecoder.java:801)JAXBEncoderDecoder.java:642)DataReaderImpl.java:156)DocLiteralInInterceptor.java:109)PhaseInterceptorChain.java:263)ClientImpl.java:795)HTTPConduit.java:1626)HTTPConduit.java:1493)HTTPConduit.java:1401)CacheAndWriteOutputStream.java:47)CachedOutputStream.java:194)AbstractConduit.java:56)HTTPConduit.java:648)MessageSenderInterceptor.java:62)PhaseInterceptorChain.java:263)ClientImpl.java:531)ClientImpl.java:461)ClientImpl.java:364)ClientImpl.java:317)ClientProxy.java:88)JaxWsClientProxy.java:134)Native
Method)NativeMethodAccessorImpl.java:39)DelegatingMethodAccessorImpl.java:25)Method.java:597)at
org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:160)SpringMethodRoadie.java:233)SpringMethodRoadie.java:333)SpringMethodRoadie.java:217)SpringMethodRoadie.java:197)SpringMethodRoadie.java:143)SpringJUnit4ClassRunner.java:160)JUnit4ClassRunner.java:51)JUnit4ClassRunner.java:44)ClassRoadie.java:27)ClassRoadie.java:37)JUnit4ClassRunner.java:42)Caused
by: javax.xml.bind.UnmarshalException- with linked exception:
[
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(
... 52 more
Caused by:
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.childElement(
at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.childElement(
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(
at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(
... 54 more
Caused by:
... 65 morejavax.xml.bind.UnmarshalException: unexpected element (uri:"http://xxxx.com/common/general/2010/1/1/platformServiceResult", local:"id").
Expected elements
are<{}id>,<{}information>,<{}systemMessageNumber>,<{}status>,<{}newToken>,<{}systemMessage>,<{}systemId>,<{}parameters>]UnmarshallerImpl.java:421)UnmarshallerImpl.java:360)UnmarshallerImpl.java:337)JAXBEncoderDecoder.java:778)javax.xml.bind.UnmarshalException:
unexpected element (uri:"http://schemas.benefitfocus.com/common/general/2010/1/1/platformServiceResult", local:"id"). Expected elements are
<{}id>,<{}information>,<{}systemMessageNumber>,<{}status>,<{}newToken>,<{}systemMessage>,<{}systemId>,<{}parameters>UnmarshallingContext.java:609)Loader.java:244)Loader.java:239)Loader.java:116)Loader.java:101)StructureLoader.java:245)UnmarshallingContext.java:452)UnmarshallingContext.java:433)StAXStreamConnector.java:275)StAXStreamConnector.java:209)UnmarshallerImpl.java:358)javax.xml.bind.UnmarshalException:
unexpected element (uri:"http://schemas.benefitfocus.com/common/general/2010/1/1/platformServiceResult", local:"id"). Expected elements
are<{}id>,<{}information>,<{}systemMessageNumber>,<{}status>,<{}newToken>,<{}systemMessage>,<{}systemId>,<{}parameters>
Below is schema def:
-----------------------------
<?xml version='1.0'
encoding='UTF-8'?><xs:schemaxmlns:tns=http://xxx.com/binders/general/2010/1/1xmlns:xs="http://www.w3.org/2001/XMLSchema"version="1.0"targetNamespace=http://xxx.com/binders/general/2010/1/1><xs:elementname="processRequestResponse"type="tns:processRequestResponse"/></xs:complexT<xs:complexTypename="processRequestResponse"><xs:sequence><xs:elementname="return"type="tns:binderReturn"minOccurs="0"/></xs:sequence></xs:complexType><xs:complexTypename="binderReturn"><xs:sequence>
<xs:elementname="binderResponse"type="tns:binderResponse"minOccurs="0"/><xs:elementname="platformServiceResult"type="tns:platformServiceResult"minOccurs="0"/></xs:sequence></xs:complexType><xs:complexTypename="binderResponse"><xs:sequence><xs:elementname="errorCode"type="xs:string"minOccurs="0"/><xs:elementname="errorMessage"type="xs:string"minOccurs="0"/><xs:elementname="requestId"type="xs:string"minOccurs="0"/><xs:elementname="source"type="xs:string"minOccurs="0"/><xs:elementname="
status"type="xs:string"minOccurs="0"/><xs:elementname="transactionId"type="xs:string"minOccurs="0"/></xs:sequence></xs:complexType><xs:complexTypename="platformServiceResult"><xs:sequence><xs:elementname="id"type="xs:string"minOccurs="0"/><xs:elementname="information"type="xs:string"nillable="true"minOccurs="0"maxOccurs="unbounded"/><xs:elementname="parameters"type="xs:string"nillable="true"minOccurs="0"maxOccurs="unbounded"/><xs:elementname="status"type="tns:platformServiceStatus"minOccurs="0"/><xs:elementname="systemId"type="xs:string"minOccurs="0"/><xs:elementname="systemMessage"type="xs:string"minOccurs="0"/><xs:elementname="systemMessageNumber"type="xs:int"minOccurs="0"/><xs:elementname="newToken"type="xs:string"minOccurs="0"/></xs:sequence><xs:simpleTypename="platformServiceStatus"><xs:restrictionbase="xs:string"><xs:enumerationvalue="SUCCESS"/></xs:restriction></xs:simpleType></
------------------------------------------------
------------------------ Below is WSDL -------------------------<definitionsxmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns:tns="http://services.benefitfocus.com/binders/general/2010/1/1"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns="http://schemas.xmlsoap.org/wsdl/"name="BinderService"targetNamespace=http://xxx.com/binders/general/2010/1/1><types><xsd:schema><xsd:importnamespace=http://xxx.com/binders/general/2010/1/1schemaLocation="see
above"/></xsd:schema></types><messagename="processRequestResponse"><partname="parameters"element="tns:processRequestResponse"/></message><soap:operationsoapAction=""/><input><soap:bodyuse="literal"/></input><output><soap:bodyuse="literal"/></output></operation><operationname="processRequest"><soap:operationsoapAction=""/><input><soap:bodyuse="literal"/></input><output><soap:bodyuse="literal"/></output></operation></binding><servicename="BinderService"><portname="BinderServicePort"binding="tns:BinderServicePortBinding"><soap:addresslocation=https://xxx.com/eProxy/service/Servicexmlns=""/><apwsdl:targetWSDLxmlns:ap=http://yyy.com/amfxmlns:apwsdl="urn:zzz.wsdl"xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"><apwsdl:URL>xxxxxx</apwsdl:URL><apwsdl:agentIDxxxxxx</apwsdl:agentID><apwsdl:uwsID>xxxxxx</apwsdl:uwsID><apwsdl:uwsLocalname>xxxxxx</apwsdl:uwsLocalname></apwsdl:targetWSDL></port></
---------------- end of wsdl ----------------
--------------- soap response from Oracle Jax-ws server -------<?xml version='1.0' encoding='UTF-8'?><S:Envelopexmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns3:processRequestResponsexmlns:ns2=http://xxxx.com/common/general/2010/1/1/platformServiceResultxmlns:ns3=http://xxxx.com/binders/general/2010/1/1><return><responseDate>2012-05-08-04:00</responseDate><binderResponse><requestId>904356447_201208</requestId><source>eHealth</source><status>succeeded</status></binderResponse><platformServiceResult><ns2:id>9faa0d0e-1932-4064-95ec-6a0e10da4c60</ns2:id><ns2:status>SUCCESS</ns2:status><ns2:systemId>ebilprodapp103</ns2:systemId></platformServiceResult></return></ns3:processRequestResponse></</S:Body>S:Envelope>
</service>definitions>xs:schema></xs:complexType>