I need to match request along with its corresponding response so i am trying to take session id for matching each request along with its response. I am using Phase.PRE_STREAM
in my constructor.
I am trying to take HttpServletRequest and session id as below in my interceptor
public void handleMessage(Message msg) {
HttpServletRequest req = (HttpServletRequest)msg.get("HTTP.REQUEST");
}
But i am getting null value. Could someone tell me how to take HttpServletRequest in apache cxf?
Do i need to set session id while creating client.I create my client as below
JAXRSClientFactoryBean sf = new JAXRSClientFactoryBean();
sf.setResourceClass(CustomerService.class);
sf.setAddress("http://localhost:9000/");
BindingFactoryManager manager = sf.getBus().getExtension(BindingFactoryManager.class);
JAXRSBindingFactory factory = new JAXRSBindingFactory();
factory.setBus(sf.getBus());
manager.registerBindingFactory(JAXRSBindingFactory.JAXRS_BINDING_ID, factory);
CustomerService service = sf.create(CustomerService.class);
WebClient wc = sf.createWebClient();
Implement SOAP Handler like so:
public class SOAPRequestHandler implements SOAPHandler<SOAPMessageContext>
And implement your handlers like so:
public boolean handleMessage(SOAPMessageContext msgContext)
{
HttpServletRequest request = (HttpServletRequest) msgContext.get("HTTP.REQUEST");
...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.