I have three services.
Requirement: Need to log all read and write requests, which is all calls to writeData() and readData() services. Validate soapMessage of writeData() service.
The way i solved: I am using SAAJ to call webservices and adding a soap header messageType with a value as
1. Cook if calling writeData().
2. Look if caling readData().
3. Validate if caling validateData().
I have written three handlers on the endpoint side and i check the value of the messageType header in handleRequest() of the following, using if then method :(.
1. LogWriteDataHandler - Logs all write requests if the header messageType value is Cook.
2. LogReadDataHandler - Logs all read requests if the header messageType value is Look.
3. validateSignatureHandler - Valdates signatures if the header messageType value is Cook.
Question: Now i am not sure if this is the best solution for my requirement. I appreciate your input or comments on this, or if there are other clean/elegent solution to my requirement.