Honestly, I'm not sure you can.   Under most circumstances in CXF, we don't 
ever create the SAAJ based SOAPMessage.   Thus, it would never be available.   
If you add in the SAAJInInterceptor, we would create it, but that's not really 
exposed to the context that the endpoint would get.   Two ways to work around 
it:

1) Register a JAX-WS SOAP handler that WOULD get the SAAJ model and then 
immediately store the message on the Context with an Application SCOPE.   The 
application would then be able to retrieve it.

2) Add the SAAJ interceptor, then use some proprietary APIs and casts to dig 
it out:

((WrappedMessageContext)wsContext.getMessageContext()).getWrappedMessage().getContent(SOAPMessage.class);


Dan



On Sat August 1 2009 3:09:07 am 김강원 wrote:
> Dear Daniel Kulp!
>
> Before 3 Weeks , I had thanks for your cool answer about the CXF’s Binding
>
> Then , I have a problem by used CXF.
>
>
>
> I want to use SoapMessage Object in ~impl.java without cxf’s intercepter
> or handler
>
> Daniel!  Is it possible???
>
>
>
> I have been try to solve it for 3day…but I am not find the solution by
> myself
>
>
>
> Simply ,  I thought like this with wsdl2java
>
>
>
>
> public class SubmitEtaxInvoicePortTypeImpl implements
> SubmitEtaxInvoicePortType {
>
>
>
> @Resource
>
>     private WebServiceContext wsContext;
>
>
>
>     public String submitEtaxInvoice(String submitID,int totalCount,String
> referenceID) {
>
>
>
>         SOAPMessageContext soapContext =
> (SOAPMessageContext)wsContext.getMessageContext();
>
>         SOAPMessage message = soapContext.getMessage();
>
>
>
> But I got a wrong message
>
> Caused by: java.lang.ClassCastException:
> org.apache.cxf.jaxws.context.WrappedMessageContext
>
>
>
> Also I had exchange code like this.
>
>
>
>
> public class SubmitEtaxInvoicePortTypeImpl implements
> SubmitEtaxInvoicePortType {
>
>
>
> @Resource
>
>     //private WebServiceContext wsContext;
>
>     //private MessageContext Context;
>
>     //private SOAPMessageContext Context;
>
>     //private SOAPMessage soapMsg
>
>
>
> Also I got a wrong message about ClassCastException or NullPointException
>
> Dear Daniel!!! What shoud I do to get SOAPMessage or SOAPMessageContext at
> SubmitEtaxInvoicePortTypeImpl.java
>
> I like to know it’s solution.
>
> Thanks for your help …

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to