You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christopher Cool <th...@gmail.com> on 2015/06/10 00:37:03 UTC

Exception in ReadHeadersInterceptor

I am making a Web Service call using CXF 2.7.8 where the response consists
of a 302 response-code with header information but no SOAP payload. When
the ReadHeadersInterceptor attempts to parse the response, the following
exception is thrown:

Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Premature end of file.
	at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:601)
	at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.nextTag(XMLStreamReaderImpl.java:1238)
	at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:152)
	at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:62)


I turned on debugging to see the incoming response, and the
LoggingInInterceptor outputs the following:

Inbound Message
----------------------------
ID: 2
Response-Code: 302
Encoding: ISO-8859-1
Content-Type:
Headers: {connection=[Close], Content-Length=[0],
Location=[/acme.policy], Server=[AcmeServer],
Set-Cookie=[MRHSHint=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT;
path=/, MRHSession=XXXXX;path=/;secure,
LastMRH_Session=XXXXX;path=/;secure]}
--------------------------------------

I took a look at the ReadHeadersInterceptor source, and it appears to me
that it expects a SOAP message. I may be interpreting the code incorrectly,
but unfortunately, I cannot connect a debugger to the server making the WS
call, so I can't interact with it.

I am not sure if this is an issue in ReadHeadersInterceptor or if I am not
correctly configuring the HTTPConduit to handle redirects. I am calling
HTTPClientPolicy.setAutoRedirect(true) in my code.

>From the debugging message I see, I think the PolicyInInterceptor is called
and the message is handled and then eventually passed to the
ReadHeadersInterceptor:

Invoking handleMessage on interceptor
org.apache.cxf.ws.policy.PolicyInInterceptor@590970
Adding interceptor
org.apache.cxf.ws.policy.PolicyVerificationInInterceptor@a2a111 to
phase pre-invoke
Chain org.apache.cxf.phase.PhaseInterceptorChain@1aee3c4 was modified.
Current flow:
  receive [PolicyInInterceptor, LoggingInInterceptor, AttachmentInInterceptor]
  post-stream [StaxInInterceptor]
  read [WSDLGetInterceptor, ReadHeadersInterceptor,
SoapActionInInterceptor, StartBodyInterceptor]
  pre-protocol [MustUnderstandInterceptor]
  post-protocol [CheckFaultInterceptor, JAXBAttachmentSchemaValidationHack]
  unmarshal [DocLiteralInInterceptor, SoapHeaderInterceptor]
  post-logical [WrapperClassInInterceptor]
  pre-invoke [SwAInInterceptor, HolderInInterceptor,
PolicyVerificationInInterceptor]
Invoking handleMessage on interceptor
org.apache.cxf.interceptor.LoggingInInterceptor@527a4a
Invoking handleMessage on interceptor
org.apache.cxf.interceptor.AttachmentInInterceptor@ec7037
Invoking handleMessage on interceptor
org.apache.cxf.interceptor.StaxInInterceptor@1585596
Invoking handleMessage on interceptor
org.apache.cxf.frontend.WSDLGetInterceptor@73fc8b
Invoking handleMessage on interceptor
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor@163985e
Invoking handleFault on interceptor
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor@163985e


Any thoughts on if this is a problem in how I make the WS call or if this
could be a problem in the ReadHeadersInterceptor?

Thanks,

Chris

Re: Exception in ReadHeadersInterceptor

Posted by Daniel Kulp <dk...@apache.org>.
This sounds like the redirect isn’t being picked up.   You would need to debug into the HTTP conduit to see why.

Dan



> On Jun 9, 2015, at 6:37 PM, Christopher Cool <th...@gmail.com> wrote:
> 
> I am making a Web Service call using CXF 2.7.8 where the response consists
> of a 302 response-code with header information but no SOAP payload. When
> the ReadHeadersInterceptor attempts to parse the response, the following
> exception is thrown:
> 
> Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
> Message: Premature end of file.
> 	at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:601)
> 	at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.nextTag(XMLStreamReaderImpl.java:1238)
> 	at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:152)
> 	at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:62)
> 
> 
> I turned on debugging to see the incoming response, and the
> LoggingInInterceptor outputs the following:
> 
> Inbound Message
> ----------------------------
> ID: 2
> Response-Code: 302
> Encoding: ISO-8859-1
> Content-Type:
> Headers: {connection=[Close], Content-Length=[0],
> Location=[/acme.policy], Server=[AcmeServer],
> Set-Cookie=[MRHSHint=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT;
> path=/, MRHSession=XXXXX;path=/;secure,
> LastMRH_Session=XXXXX;path=/;secure]}
> --------------------------------------
> 
> I took a look at the ReadHeadersInterceptor source, and it appears to me
> that it expects a SOAP message. I may be interpreting the code incorrectly,
> but unfortunately, I cannot connect a debugger to the server making the WS
> call, so I can't interact with it.
> 
> I am not sure if this is an issue in ReadHeadersInterceptor or if I am not
> correctly configuring the HTTPConduit to handle redirects. I am calling
> HTTPClientPolicy.setAutoRedirect(true) in my code.
> 
> From the debugging message I see, I think the PolicyInInterceptor is called
> and the message is handled and then eventually passed to the
> ReadHeadersInterceptor:
> 
> Invoking handleMessage on interceptor
> org.apache.cxf.ws.policy.PolicyInInterceptor@590970
> Adding interceptor
> org.apache.cxf.ws.policy.PolicyVerificationInInterceptor@a2a111 to
> phase pre-invoke
> Chain org.apache.cxf.phase.PhaseInterceptorChain@1aee3c4 was modified.
> Current flow:
>  receive [PolicyInInterceptor, LoggingInInterceptor, AttachmentInInterceptor]
>  post-stream [StaxInInterceptor]
>  read [WSDLGetInterceptor, ReadHeadersInterceptor,
> SoapActionInInterceptor, StartBodyInterceptor]
>  pre-protocol [MustUnderstandInterceptor]
>  post-protocol [CheckFaultInterceptor, JAXBAttachmentSchemaValidationHack]
>  unmarshal [DocLiteralInInterceptor, SoapHeaderInterceptor]
>  post-logical [WrapperClassInInterceptor]
>  pre-invoke [SwAInInterceptor, HolderInInterceptor,
> PolicyVerificationInInterceptor]
> Invoking handleMessage on interceptor
> org.apache.cxf.interceptor.LoggingInInterceptor@527a4a
> Invoking handleMessage on interceptor
> org.apache.cxf.interceptor.AttachmentInInterceptor@ec7037
> Invoking handleMessage on interceptor
> org.apache.cxf.interceptor.StaxInInterceptor@1585596
> Invoking handleMessage on interceptor
> org.apache.cxf.frontend.WSDLGetInterceptor@73fc8b
> Invoking handleMessage on interceptor
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor@163985e
> Invoking handleFault on interceptor
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor@163985e
> 
> 
> Any thoughts on if this is a problem in how I make the WS call or if this
> could be a problem in the ReadHeadersInterceptor?
> 
> Thanks,
> 
> Chris

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com