Hi
On 19/06/12 14:11, Daniel Hagen wrote:
Hi,

we've been using CXF (currently 2.1.3, soon 2.5.4) on the server side for some 
time now (in Tomcat 6.0 with Spring 3.0 if that is of any interest).

We have one client that - for whatever reason - performs HTTP HEAD-Requests to 
the WSDL-Urls (http://.../services/Endpoint?wsdl) before performing it's calls.

We only recently noticed that those calls fail under certain circumstances with cxf 2.1.3 
due to an exception "org.apache.cxf.binding.soap.SoapFault: Error reading 
XMLStreamReader." in the class ReadHeadersInterceptor (See below for full 
stacktrace). From what we've been able to discern so far, the problem seems to be 
reproducable only when the server has been just started and no HTTP GET requests have 
been made to the WSDL URL yet. Once the first HTTP GET to that URL has been sent, 
subsequent HTTP HEAD Requests succeed.

With CXF 2.5.4 those Exceptions are easier to reproduce - they are thrown every 
time an HTTP HEAD request is sent to one of the WSDLs, regardless whether a 
HTTP GET has previously been sent.

After stepping through the CXF 2.5.4 code I would guess that the problem is in 
WSDLGetInterceptor - for GET requests the interceptor performs it's work and finishes 
with a call to "message.getInterceptorChain().abort();", for HEAD requests it 
returns immediatedly without that call to abort() which causes the ReadHeadersInterceptor 
to be called, which then promptly fails.

Is this a bug in CXF or a configuration issue? If it is a bug is there a way to 
work around this? (Other than changing the clients so they don't send HTTP Head 
requests)


I'm not sure how HEAD WSDL queries have to be managed on the JAX-WS path, but you can definitely work around this issue by registering a custom interceptor that will be installed before WSDlGetInterceptor (you can request it explicitly in the constructor of the custom interceptor but not be even needed), which will check if it is HEAD and if yes then replace the method name with GET

HTH, Sergey

Best Regards

Daniel


This is the stacktrace logged by CXF:

org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
        at 
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:183)
        at 
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:56)
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
        at 
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
        at 
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
        at 
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:285)
        at 
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:168)
        at 
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:175)
        at 
org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFServlet.java:157)
        at javax.servlet.http.HttpServlet.doHead(HttpServlet.java:241)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
        at 
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
        at 
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
        at 
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
        at 
de.konsens.gda.server.ServiceUrlRewriteFilter.forwardToBasePath(ServiceUrlRewriteFilter.java:51)
        at 
de.konsens.gda.server.ServiceUrlRewriteFilter.doFilter(ServiceUrlRewriteFilter.java:29)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
        at java.lang.Thread.run(Thread.java:662)
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
  at [row,col {unknown-source}]: [1,0]
        at 
com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:686)
        at 
com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134)
        at 
com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040)
        at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
        at 
com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1095)
        at 
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:85)
        ... 31 more


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to