2
我想從這樣的字符串創建SOAP 1.2消息:爲什麼無法從給定源創建信封?
String soapIn = "<?xml version='1.0' encoding='UTF-8'?>\n" +
"<soapenv:Envelope xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\">\n" +
" <soapenv:Header />\n" +
" <soapenv:Body>\n" +
" <ns:getChannelLineupInfoResponse xmlns:ns=\"http://channellineup.services.vidctlwhse.oss.cable.comcast.com/xsd\">\n" +
" <ns:return>\n" +
" <?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" +
" <response rows=\"1044\" type=\"success\">\n" +
" </response>\n" +
" </ns:return>\n" +
" </ns:getChannelLineupInfoResponse>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
logger.debug("InneoquestSoapHandler.createNewSoapResponse: about to createMessage...");
SOAPMessage newMsg = messageFactory.createMessage(
new MimeHeaders(),
new ByteArrayInputStream(soapIn.getBytes(Charset.forName("UTF-8"))));
logger.debug("InneoquestSoapHandler.createNewSoapResponse: about to get new envelope...");
SOAPEnvelope newEnv = newMsg.getSOAPPart().getEnvelope(); //fails here
logger.debug("InneoquestSoapHandler.createNewSoapResponse: about to get old envelope...");
但要「無法創建從給定的來源信封」在這一行google搜索失敗的
SOAPEnvelope newEnv = newMsg.getSOAPPart().getEnvelope(); //fails here
小時找到解決方案。有任何想法嗎?
謝謝!我的工作方式有所不同,但如果你能將它運用到圖書館,我會盡力說服你。我會接受你的回答。 – user3217883