Spring Web Services
Exercise: Todo SOAP Service (Interceptors)
The objective of this exercise is to add
Apache CXF Interceptors to the SOAP-based todo web service and client.
Assignment
- Logging Interceptors
- Authentication Outbound Interceptor
-
Derive the
AuthOutInterceptor from the AbstractSoapInterceptor and add it to the PRE_PROTOCOL phase using the base constructor.
-
Implement the
handleMessage that adds a header with a security token to outgoing SOAP messages
Header header = new Header(name, token, new JAXBDataBinding(String.class));
message.getHeaders().add(header);
-
In the
WebClientConfig class, add the interceptor to the client proxy of the web service
ClientProxy.getClient(proxy).getOutInterceptors().add(interceptor);
- Authentication Inbound Interceptor
Solution Service
Solution Client