我有一个网络服务电话.在我的响应中,当我尝试将xml any元素放入JAXBElement时,它会抛出错误.
在模式中我有:
<xs:complexType name="InputType">
<xs:annotation></xs:annotation>
<xs:sequence>
<xs:element name="Id" type="xs:string" />
<xs:any namespace="##any" processContents="lax" minOccurs="0" />
</xs:sequence>
</xs:complexType>
Run Code Online (Sandbox Code Playgroud)
我正在使用的代码:
Object obj = inputType.getAny();
Object o = ((JAXBElement)obj).getValue();
Run Code Online (Sandbox Code Playgroud)
这行引发了错误:org.apache.xerces.dom.ElementNSImpl incompatible with javax.xml.bind.JAXBElementsoap ui中的错误.
为什么它不转换为JAXBElement?我如何使其工作?