Can someone tell me why I'm getting this parse error? The XML looks fine to me. It's failing with SAXException=XML document structures must start and end within the same entity.
At this line:
Document doc = builder.parse(inputSource); //fails here
Here is the code:
String soapIn = "<?xml version='1.0' encoding='UTF-8' ?>\n" +
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:vid=\"http://videocontrollerchannelmap.queryservice.vcwh.oss.my.company.com/\">\n" +
" <soapenv:Header/>\n" +
" <soapenv:Body>\n" +
" <vid:getInneoquestChannelMap>\n" +
" <appkey>ONE_CONTROLLER</appkey>\n" +
" <forceUpdate>true</forceUpdate>\n" +
" </vid:getInneoquestChannelMap>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope";
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
SOAPMessage newMsg = null;
try {
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource inputSource = new InputSource(new StringReader(soapIn));
Document doc = builder.parse(inputSource); //fails here
DOMSource domSource = new DOMSource(doc);
你缺少>
上"</soapenv:Envelope"
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.