抛出异常时,SoapOutEndingInterceptor失败

时间:2018-06-06 07:46:43

标签: cxf interceptor

当从我们的Web服务拦截器抛出错误时,我们不断获得异常:

Caused by: javax.xml.stream.XMLStreamException: No open start element, when trying to write end element
at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1537) [woodstox-core-asl-4.4.1.jar:4.4.1]
at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1566) [woodstox-core-asl-4.4.1.jar:4.4.1]
at com.ctc.wstx.sw.BaseNsStreamWriter.doWriteEndTag(BaseNsStreamWriter.java:648) [woodstox-core-asl-4.4.1.jar:4.4.1]
at com.ctc.wstx.sw.BaseNsStreamWriter.writeEndElement(BaseNsStreamWriter.java:280) [woodstox-core-asl-4.4.1.jar:4.4.1]
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:300) [cxf-rt-bindings-soap-3.0.6.jar:3.0.6]

否则服务很有效。看来我们在传出的拦截器中遗漏了一些东西。

   public void handleMessage(SoapMessage message) {
    OutputStream os = message.getContent(OutputStream.class);
    CachedStream cs = new CachedStream();
    message.setContent(OutputStream.class, cs);
    // Throw works fine here
    message.getInterceptorChain().doIntercept(message);
    // Hereafter throw fails

有人能指出我们某个方向吗?

0 个答案:

没有答案