On Fri April 24 2009 6:02:23 pm bharath thippireddy wrote:
> I see a classcast exception when typecasting the WebServiceContext or
> MessageContext to a SOAPMessageContext.I see a similar problem in a bug
> which is reported .
>
>
>
> https://issues.apache.org/jira/browse/CXF-1511
>
>
>
> Is there an other way of retrieving the soap headers from the
> WebServiceContext directly instead of using the SOAPMessageContext?
The JAX-WS spec really just defines the SOAPMessageContext for use with the
SOAPHandlers. For CXF, we really don't create the SAAJ model unless it's
REALLY needed so we wouldn't be able to supply that to the implementation. I
suppose we COULD detect if we did create the SAAJ (for example: with ws-
security situations, we do have to create it. Of if JAX-WS soap handlers are
used) and flip to a SOAPMessageContext for the call to the implementation, but
that really wouldn't be "reliable".
For CXF, you can get the headers directly from the WebServiceContext via:
ctx.get(org.apache.cxf.headers.Header.HEADER_LIST)
which will return a List<org.apache.cxf.headers.Header>.
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog