我需要帮助解封SOAP响应使用JAXB java类
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>DLResponseException</faultstring>
<detail>...
....
我创建了一个带有根元素的java类,如下所示
@XmlRootElement(name="Fault", namespace="http://schemas.xmlsoap.org/soap/envelope/")
public class MFaultResponse{
..
}
使用:
InputStream is = new ByteArrayInputStream(sample.getBytes());
JAXBContext jaxbContext = JAXBContext.newInstance(MFaultResponse.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
MFaultResponse response= (MFaultResponse) jaxbUnmarshaller.unmarshal(is);
System.out.println(response.getFaultCode());
异常:
由: org.xml.sax.SAXParseException;lineNumber: 1;columnNumber: 16引起;未绑定元素“soapenv:columnNumber”的前缀"soapenv“。
https://stackoverflow.com/questions/51486336
复制相似问题