I have a SOAP webservice(spring ws)and need to save the response time of every request that I receive. I could create a servlet filter that measures time difference between HTTP Request and HTTP Response. But, I need to log the response time together with some values that I read from soap request envelope, and since at that time request is raw and needs to be unmarshalled, that's an expensive and redundant operation to unmarshall for every request.
So is there a way to calculate it using SpringWS? like in a payloadInterceptor?
Yes, implementing an
EndpointInterceptor
is the best fit for this task, as it gives you access to the SOAP messages through theMessageContext
. See the Reference Documenation.