我有一大段这样的代码:
AxiomSoapMessage message = (AxiomSoapMessage)webServiceMessage;
SoapHeader soapHeader = message.getSoapHeader();
SOAPMessage soapMessage = message.getAxiomMessage();
TransportContext transContext = TransportContextHolder.getTransportContext();
HttpServletConnection connection = (HttpServletConnection)transContext.getConnection();
HttpServletRequest httpRequest = connection.getHttpServletRequest();
InputStream inputStream = httpRequest.getInputStream();
SniffedXmlInputStream sniffedXmlInputStream = new SniffedXmlInputStream(inputStream);
String encoding = sniffedXmlInputStream.getXmlEncoding();
sniffedXmlInputStream.close();
String soapVersion = message.getVersion().toString();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
**soapMessage.serialize(baos);** //THIS LINE
这是接收 Spring ws 的WebServiceMessage的类的一部分,我从中提取SOAPMessage,如上所示。
在上面代码中用“THIS LINE”标记的粗体行,我“有时”得到以下异常
org.springframework.integration.MessageHandlingException:
org.apache.axiom.om.OMException:
javax.xml.stream.XMLStreamException:
ParseError at [row,col]:[1,4090] Message: Stream closed
有什么解决办法吗?