Sep 29th, 2011, 02:43 PM
SOAP Header - How to echo soap header payload from service request to response/fault
Hi, I am in the process of implementing a spring ws and have a few questions regarding the handling of SOAP headers.
A few basic background regarding my current approach
- My interceptor SoapHeaderInterceptor implements EndpointInterceptor
- I have overriden the handleRequest, handleResponse and handleFault
- Presently I am doing a ThreadLocal storage of the SoapHeader in my handleRequest and retrieve it in my handleResponse and handleFault.
What I am observing when I run my service
- I invoke SoapHeader header = ((SoapMessage) messageContext.getRequest()).getSoapHeader() to get the header in the handleRequest and handleResponse object. Based on the object id (address hash) it appears to be the same object. Is this the expected behavior - that the Soap Header instances will be the same in the handleRequest/handleResponse/handleFault methods?
- If the above SoapHeader object is the same, I would expect any Soap Header attributes supplied in the service request to be implicitly be available in the SoapHeader of the response. Presently this is not the case.
- Inspecting the header available in the handleResponse/handleFault methods through examinAllHeaderElements() shows the input soap header with the header payload present. But the service response and fault results do not show any of the Soap header attributes going back to the service client.
My present need is to just echo back the SOAP Header block. How do I accomplish this? I am looking for some suggestions to steer me in the right direction.
Tags for this Thread