You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by bharath thippireddy <bh...@oracle.com> on 2009/04/25 00:02:23 UTC

Problem Retrieving Soap Headers From WebServiceContext(bug 1511)

 

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?

 

Thanks and regards,

Bharath

 


Re: Problem Retrieving Soap Headers From WebServiceContext(bug 1511)

Posted by Daniel Kulp <dk...@apache.org>.


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
dkulp@apache.org
http://www.dankulp.com/blog