Anand Jayaraman [http://community.jboss.org/people/anand201301] replied to the discussion
"How to share session between web service calls?" To view the discussion, visit: http://community.jboss.org/message/557502#557502 -------------------------------------------------------------- Hi, I tried the above approach. It didn't work for me. I can clearly see two different JSESSIONIDs between the request/response. However when i use the HttpConduit approach the JSESSIONIDs are exactuly the same between the two request/responses.I am pasting the code i am trying out below: String target = "http://localhost:9090/CXFDemo"; IHelloService service = *new IHelloService();IHello stub = service.getIHelloPort(); BindingProvider bp = (BindingProvider)stub; bp.getRequestContext().put(BindingProvider. +ENDPOINT_ADDRESS_PROPERTY, target);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")); // This turns out to be null. *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 str = stub.hello( "hello world!!"); //Creating a second service instance IHelloService service1 = *new IHelloService();IHello stub1 = service1.getIHelloPort(); BindingProvider provider1 = (BindingProvider)stub1; provider1.getRequestContext().put(BindingProvider. +ENDPOINT_ADDRESS_PROPERTY, target);provider1.getRequestContext().put(BindingProvider. +SESSION_MAINTAIN_PROPERTY, *true); Map<String, List<String>> headers1= CastUtils.+cast+((Map)provider1.getRequestContext().get( "javax.xml.ws.http.request.headers")); *if (headers1 == *null) {headers1 = *new HashMap<String, List<String>>(); // Putting back the headers from the first request.provider1.getRequestContext().put( "javax.xml.ws.http.request.headers", headers);} String greeting = stub1.hello( "Bonjour"); Please let me know if i need to correct something? Regards, Anand *++******++**** * ** *+ + * * * ** *+ + * *++******++**** * ** *+ + * * * ** *+ + * *++******++**** * ** *+ + * * * ** *+ + * **++******++**** * ** *+ + * * * ** *+ + * ***++******++*** ** *+ + * * * ** *+ + * *++******++* *+ + * * * ** *+ + * *+*++******++* *+ + * * * ** *+ + * +*++******+ + * * * ** *+ + * **++****** * * * ** *+ + * *++***** * * ** *+ + * *++***** * * ** *+ + * *++***** * * ** *+ + * **++***** * * ** *+ + * *++**** * ** *+ + * **++**** * ** *+ + * ***++*** ** *+ + * *++* *+ + * *++* *+ + * *+*++* *+ + * +*+ + * ** * -------------------------------------------------------------- Reply to this message by going to Community [http://community.jboss.org/message/557502#557502] Start a new discussion in JBoss Web Services CXF at Community [http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2046]
_______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
