How to extract HTTPHeader from WebServiceTemplate.marshalSendAndReceive() Response
Hello, I am relatively new to Web Services and I want to know how to extract HTTP cookies from a soap request.
I am using spring WS clent and XMLBeans to marshal / un-marshal. My code snippet:
Code:
SoapActionCallback sac = new SoapActionCallback(soapAction){
public void doWithMessage(WebServiceMessage msg){
SoapMessage smsg = (SoapMessage) msg;
smsg.setSoapAction(soapAction);
}
};
LoginResponseDocument response = (LoginResponseDocument) webServiceTemplate.marshalSendAndReceive(requestPayload, sac);
Responses:
Code:
System.out.println("responseXmlText: "+response.getLoginResponse().xmlText());
System.out.println("responseLoginSuccess: "+response.getLoginResponse().validate());
<xml-fragment><v200:LoginResult xmlns:v200="http://asp.net/ApplicationServices/v200">true</v200:LoginResult></xml-fragment>
true
QUESTION:
How do I extract HTTPHeader/cookies (authentication ticket) from webServiceTemplate response as I do not see any HTTP context available. If not so, is there any workaround? An example would greatly help.
Thank you.