You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Iwan Zarembo <iw...@zarembo.de> on 2015/03/17 10:18:42 UTC

Re: UnmarshalException: unexpected element (uri:"urn:java/lang", local:"String")

Hi,
It took a while, but the only possibility to get rid of the problem, that
array elements require item tags was to disable the jaxb validation event
handler.
So my code to fix it (without having a direct dependency to CXF) was:

MyWebService webService = new MyWebService(wsdlUrl);
wsPort = webService.getPort(.....);
Map<String, Object> requestContext =
((BindingProvider)wsPort).getRequestContext();
requestContext.put("set-jaxb-validation-event-handler", "false");

I got the hint from the thread:
http://mail-archives.apache.org/mod_mbox/cxf-users/201001.mbox/%3C201001291547.56047.dkulp@apache.org%3E

Of course this will disable the whole jaxb-validation.

Cheers,

Iwan


2014-07-30 15:14 GMT+02:00 Iwan Zarembo <iw...@zarembo.de>:

> Hi,
> I have a really weird error when consuming a WebService on WildFly 8.1 or
> JBoss 7.1.0 where cxf is used to consume WebServices. But the call works on
> Tomcat 7/8.
> In general consuming other parts of my WebService is not an issue, only
> one response causes  an UnmarshalException.
> The XML response from the WebService is:
> <?xml version="1.0" encoding="utf-8"?>
> <SOAP-ENV:Envelope xmlns:SOAP-ENV="
> http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="
> http://www.w3.org/2001/XMLSchema" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance">
>   <SOAP-ENV:Body xmlns:rpl="urn:CBSWebServiceDef/CBSWebServiceVI">
>     <rpl:getDCVariantStatesResponse xmlns:rn0="urn:com.sap.tc.cbs.types"
> xmlns:rn1="java:sap/standard" xmlns:rn2="
> http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:rn3="urn:com/sap/tc/cbs/types" xmlns:rn4="urn:java/lang">
>       <rpl:Response>
>         <rn3:succeed>true</rn3:succeed>
>         <rn3:errorCode/>
>         <rn3:trace/>
>         <rn3:variantStates>
>           <rn3:DCVariantState>
>             <rn3:dcName>crm/migr/xcm</rn3:dcName>
>             <rn3:dcVendor>sap.com</rn3:dcVendor>
>             <rn3:dcBuildNumber>0</rn3:dcBuildNumber>
>             <rn3:variantBuildNumber>797</rn3:variantBuildNumber>
>             <rn3:broken>false</rn3:broken>
>             <rn3:dirty>false</rn3:dirty>
>             <rn3:deployable>true</rn3:deployable>
>             <rn3:publicParts>
>               <rn4:String>assembly</rn4:String>
>             </rn3:publicParts>
>           </rn3:DCVariantState>
>         </rn3:variantStates>
>       </rpl:Response>
>     </rpl:getDCVariantStatesResponse>
>   </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> The error in the stacktrace is:
>
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> 	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
> 	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:570)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:479)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382)
> 	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335)
> 	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
> 	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
> 	... 13 more
> Caused by: com.sun.istack.SAXParseException2; lineNumber: 1; columnNumber: 915; unexpected element (uri:"urn:java/lang", local:"String"). Expected elements are <{}item>
> 	...
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:180)
> 	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:370)
> 	... 37 more
> Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"urn:java/lang", local:"String"). Expected elements are <{}item>
> 	... 48 more
>
>
> Can anyone help me to find out how to get rid of the UnmarshalException?
>
> Kind Regards,
>
> Iwan
>