我想 Unmarshaller 的 XMLStreamReader 对象,但它给了我错误。
我的代码如下:-
SoapHeader soapHeader = ((SoapMessage) message).getSoapHeader();
Unmarshaller unmarshaller = null;
XMLInputFactory xif = XMLInputFactory.newFactory();
xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false);
xif.setProperty(XMLInputFactory.SUPPORT_DTD, false);
if (null != getDummyResponse()) {
XMLStreamReader soapHeaderXsr = xif.createXMLStreamReader(soapHeader.getSource());
unmarshaller = JaxbUtil.getUnmarshaller(Dummy.class,Test.class);
unmarshaller.unmarshal(soapHeaderXsr);
} else {
unmarshaller = JaxbUtil.getUnmarshaller(Test.class);
}
错误 :-
com.dummy.exception.InvalidArgException: 无法解析 XMLjava.lang.UnsupportedOperationException: 无法从 javax.xml.transform.dom.DOMSource 创建 XMLStreamReader 或 XMLEventReader\n\tat com.dummy.connectors.SoapConnector.soapRequest(SoapConnector.java :54)\n\tat org.dummy.test.consumer.test.proccedLogin(test.java:180)\n\tat org.dummy.test.consumer.test.proceeddummyRequest(test.java:87)\n\ tat org.dummy.test.consumer.test$$FastClassBySpringCGLIB$$46f53c92.invoke()\n\tat org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)\n\tat org.springframework。 aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)\n\tat org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)\n\tat org.springframework.aop.interceptor。异步执行拦截器。lambda$invoke$0(AsyncExecutionInterceptor.java:115)\n\tat java.util.concurrent.FutureTask.run(Unknown Source)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\n\tat java .util.concurrent.ThreadPoolExecutor$Worker.run(未知来源)\n\tat java.lang.Thread.run(未知来源)\n
请尽快给出解决方案。
谢谢