java - 无法从 DOMSource 创建 XMLStreamReader 或 XMLEventReader
问题描述
我想 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
请尽快给出解决方案。
谢谢
解决方案
推荐阅读
- python - 使用 pip install --target 固定 git 修订的版本号
- javascript - 如何在executeSql中修复“INSERT INTO错误代码:0”
- r - R:在填充了各种长度的 NA 值的数据框中,将每行的第 2 列添加到非 NA 行的最后一列
- javascript - 请解释这个js代码片段发生了什么
- javascript - 为什么 window.open() 和 window.close() 在 Extension 中不起作用?
- microsoft-graph-api - 图形 API - 驱动器上传后更新 SharePoint 库字段
- html - 侧边栏 z-index 始终高于下拉菜单
- python - 我需要以日期格式在第一个多索引上打印一个字符串
- tensorflow - 使用与系统不同的 GCC 从源代码构建 TensorFlow 时包含错误
- jquery - CSS 显示:弹性;在 IE 浏览器中无法正常工作