I really don't think there is a way to do this.   Not that I can think of 
anyway.  Hmmmmm......

I'm not sure if you add a method like:

public void handleMessage(Message m) {
   if (m instanceof SoapMessage) {
      handleMessage((SoapMessage)m);
   }
}
or similar if the compiler will even allow that. I've never really tried to 
explicitly add a method that that compiler would normally have generated for 
the generic methods.    Normally, the compiler auto generates a method that 
does:
public void handleMessage(Message m) {
    handleMessage((SoapMessage)m);
}
Don't know if you can actually provide one so the compiler doesn't need to 
generate one.


If that works, I wonder if adding it to AbstractSoapInterceptor would make 
sense to make sure it's only called for soap.   Interesting thought.

Dan




On Fri October 9 2009 2:51:40 pm Adam Lewandowski wrote:
> I've got an application that has both JAX-WS and JAX-RS endpoints. I also
> have an interceptor that handles custom SOAP headers (extends
> AbstractSoapInterceptor). I've tried adding the interceptor via the
> <cxf:bus>/<cxf:inInterceptors> tag in the Spring context but this puts the
> interceptor at the bus level, which interferes with the JAX-RS endpoints.
> Invoking a JAX-RS endpoint results in a ClassCastException when it tries to
> invoke my interceptor's handleMessage(SoapMessage) method with an
> XMLMessage.
> 
> Is there a way to add the interceptor to just the SOAP binding, using
>  Spring configuration only? Failing that, how can it be done
>  programatically?
> 
> Thanks,
> Adam Lewandowski
> 

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

Reply via email to