Hi,
I needed one clarification, will this work if there are two separate instances of BindingProvider being used from client code. For e.g.
Greeter greeter = service.getGreeterPort();
BindingProvider bp = (BindingProvider)greeter;
bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
Map<String, List<String>> headers= CastUtils.cast((Map)bp.getRequestContext().get("javax.xml.ws.http.request.headers"));
if (headers == null) {
headers = new HashMap<String, List<String>>();
bp.getRequestContext().put("javax.xml.ws.http.request.headers", headers);
}
List<String> cookies = Arrays.asList(new String[] {"a=a", "b=b"});
headers.put("Cookie", cookies);
String greeting = greeter.greetMe("Bonjour");
//After this invocation i am creating a brand new instance of binding provider .
Greeter greeter1 = service1.getGreeterPort();
BindingProvider bp1 = (BindingProvider)greeter1;
bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
Map<String, List<String>> headers= CastUtils.cast((Map)bp1.getRequestContext().get("javax.xml.ws.http.request.headers"));
if (headers == null) {
headers = new HashMap<String, List<String>>();
bp.getRequestContext().put("javax.xml.ws.http.request.headers", headers);
}
List<String> cookies = Arrays.asList(new String[] {"a=a", "b=b"});
headers.put("Cookie", cookies);
String greeting = greeter1.greetMe("Bonjour");
-------------------------------------------------------------------------------------------------
The headers set in the first BindingProvider may not be same as the headers in the second binding provider because CXF would create a different cookie for the second BindingProvider instance.
So is the solution to keep the header, cookie information in a local data structure in the client side and keep copying it back to all new BindingProvider instances created from client side so that the same cookie information is relayed back to the server?
But this way it would not be too different from the HttpConduit approach i had mentioned earlier.
Are there any changes on the server that also needs to be done?
Regards,
Anand