THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
import org.apache.cxf.endpoint.Client; import org.apache.cxf.frontend.ClientProxy; ... FooService client = ... ; // created from ClientProxyFactoryBean or generated JAX-WS client MyInterceptor myInterceptor = new MyInterceptor(); Client cxfClient = ClientProxy.getClient(client); cxfClient.getInInterceptor().add(myInterceptor); |
You can also use annotation to add the interceptors from the SEI or service class.
Code Block | ||||
---|---|---|---|---|
| ||||
@org.apache.cxf.interceptor.InInterceptors (interceptors = {"com.example.Test1Interceptor" })
@org.apache.cxf.interceptor.InFaultInterceptors (interceptors = {"com.example.Test2Interceptor" })
@org.apache.cxf.interceptor.OutInterceptors (interceptors = {"com.example.Test1Interceptor" })
@org.apache.cxf.interceptor.InFaultInterceptors (interceptors = {"com.example.Test2Interceptor","com.example.Test3Intercetpor" })
@WebService(endpointInterface = "org.apache.cxf.javascript.fortest.SimpleDocLitBare",
targetNamespace = "uri:org.apache.cxf.javascript.fortest")
public class SayHiImplementation implements SayHi {
public long sayHi(long arg) {
return arg;
}
...
}
|
Adding interceptors through configuration
...