java - Consuming service with problematic wsdl - Unexpected Element Exception -
i have consume service problematic wsdl (cannot change it). @ first had custom mapping because generated classes in java.x package. generated vanilla client , tried use it:
services handle = new services(new url("http://172.16.1.2:8080/axis2/services/x?wsdl")); servicesporttype service = handle .getserviceshttpsoap11endpoint(); x.y.ws.datamodels.xsd.objectfactory obj = new x.y.ws.datamodels.xsd.objectfactory(); ipinterfaceinfo sourceipinterface = obj.createipinterfaceinfo(); service.getinformation(sourceipinterface);
anyway code doing literally nothing , contains empty values trows exception:
warning: interceptor {http://workflowprocessor.ws.y.x}services# {http://workflowprocessor.ws.y.x}getbandwidthinformation has thrown exception, unwinding org.apache.cxf.interceptor.fault: unmarshalling error: unexpected element (uri:"http://datamodels.ws.y.x/xsd", local:"infostring"). expected elements <{http://logging.util.java/xsd}resourcebundlename>,<{http://logging.util.java/xsd}resourcebundle>,<{http://logging.util.java/xsd}parent>,<{http://logging.util.java/xsd}useparenthandlers>,<{http://logging.util.java/xsd}filter>,<{http://logging.util.java/xsd}handlers>,<{http://logging.util.java/xsd}level>,<{http://logging.util.java/xsd}name> @ org.apache.cxf.jaxb.jaxbencoderdecoder.unmarshall(jaxbencoderdecoder.java:822) @ org.apache.cxf.jaxb.jaxbencoderdecoder.unmarshall(jaxbencoderdecoder.java:643) @ org.apache.cxf.jaxb.io.datareaderimpl.read(datareaderimpl.java:157) @ org.apache.cxf.interceptor.docliteralininterceptor.handlemessage(docliteralininterceptor.java:109) @ org.apache.cxf.phase.phaseinterceptorchain.dointercept(phaseinterceptorchain.java:263) @ org.apache.cxf.endpoint.clientimpl.onmessage(clientimpl.java:799) @ org.apache.cxf.transport.http.httpconduit$wrappedoutputstream.handleresponseinternal(httpconduit.java:1635) @ org.apache.cxf.transport.http.httpconduit$wrappedoutputstream.handleresponse(httpconduit.java:1502) @ org.apache.cxf.transport.http.httpconduit$wrappedoutputstream.close(httpconduit.java:1410) @ org.apache.cxf.transport.abstractconduit.close(abstractconduit.java:56) @ org.apache.cxf.transport.http.httpconduit.close(httpconduit.java:650) @ org.apache.cxf.interceptor.messagesenderinterceptor$messagesenderendinginterceptor.handlemessage(messagesenderinterceptor.java:62) @ org.apache.cxf.phase.phaseinterceptorchain.dointercept(phaseinterceptorchain.java:263) @ org.apache.cxf.endpoint.clientimpl.doinvoke(clientimpl.java:533) @ org.apache.cxf.endpoint.clientimpl.invoke(clientimpl.java:463) @ org.apache.cxf.endpoint.clientimpl.invoke(clientimpl.java:366) @ org.apache.cxf.endpoint.clientimpl.invoke(clientimpl.java:319) @ org.apache.cxf.frontend.clientproxy.invokesync(clientproxy.java:88) @ org.apache.cxf.jaxws.jaxwsclientproxy.invoke(jaxwsclientproxy.java:134) @ $proxy34.getbandwidthinformation(unknown source) @ adva.simpletest.main(simpletest.java:33)
caused by: javax.xml.bind.unmarshalexception
validation may disabled setting option set-jaxb-validation-event-handler
, example:
services servicehandle = new services(new url("http://172.16.2.3:8080/axis2/services/x?wsdl")); servicesporttype port = servicehandle .getserviceshttpsoap11endpoint(); java.util.map<string, object> requestcontext = ((javax.xml.ws.bindingprovider) port).getrequestcontext(); requestcontext.put("set-jaxb-validation-event-handler", "false");
Comments
Post a Comment