I'm using a Spring (2.5.6) CXF (2.1.3) service set up with something like this:
<jaxws:endpoint
id="soapService"
implementor="#myService"
address="/MyService" />
I'd like to add a filter/interceptor/handler to read some arbitrary
SOAP headers and decide whether to let the processing continue. The
WSDL/Schema for the service is ignorant of these headers and their
associated data types.
I first tried to add a CXF interceptor like this:
<jaxws:endpoint
id="soapService"
implementor="#myService"
address="/MyService">
<jaxws:inInterceptors>
<ref bean="testSoapInterceptor" />
</jaxws:inInterceptors>
</jaxws:endpoint>
But this interceptor sees NO headers at all (it gets an empty list
from SoapMessage.getHeaders()). I wonder if that's because they're
not in the schema so JAXB doesn't know how to decode them?
Anyway, then I tried adding a JAX-WS handler. I marked up my service
implementation bean like this:
@HandlerChain(file="soapHandlers.xml")
public class MyServiceImpl implements MyService {
...
Then I created a soapHandlers.xml in the same package directory as that class:
<?xml version="1.0" encoding="UTF-8"?>
<jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee">
<jws:handler-chain>
<jws:handler>
<jws:handler-class>sample.soap.ServerHandler</jws:handler-class>
</jws:handler>
</jws:handler-chain>
</jws:handler-chains>
But this just seems to be ignored. At runtime I get no messages about
the JAX-WS handler being created or applied, and I get no output from
the hander's handleMessage method at all.
I'm running out of ideas. What's the best way to do this?
Thanks,
Aaron