Hello, this might not be the right list since it is probably mostly a JAX-WS client programming question, but since I have tracked the problem to Axis2, I hope you can help me anyway.
We have developed a client for some webservices using JAX-WS under WebSphere. The web services we have to call are designed in such a way, that service2.methodB() must be called in the same HTTP session as service1.methodA(). The question now is: * How can one transfer the session info from one service proxy (service1) to another one (service2), so that it is sucessfully used by service2.methodB() even if this method returns no more session information via Set-Cookie2? The way we tried is by setting the property javax.xml.ws.session.maintain to true for the requestContext of both web service proxies (service1 and service2). We also extracted the cookie returned by service1.methodA() and set it in the requestContext for service2.methodB(). The call to the server returns a valid SOAP response (the cookie is in the HTTP request for service2.methodB(), the session on the server is found, processing there is successful). But during the processing of the response on the client, Axis returns an exception with the message "Error: Maintain Session is enabled but none of the session properties (Cookies, Over-written URL) are returned." This exception comes from org.apache.axis2.jaxws.BindingProvider.setupSessionContext(). If I've analysed this correctly, the reason for the exception is that the ServiceContext properties don't contain a cookie. This even though we have set the cookie returned by service1.methodA() to the requestContext of service2 before the call to service2.methodB(). My assumption now is that the cookie is set only in the ServiceContext properties, if a HTTP response really contains a "Set-Cookie2: xxx", but not if we set the cookie to the requestContext before the call. As an alternative solution, we tried to set javax.xml.ws.session.maintain to false for service2, and still set the cookie value to the requestContext of service2, but then the cookie is not even sent to the server. So I'm looking for ways to achieve a successful connection to service2.methodB() using the session from service1.methodA() even in this particular scenario. Thanks for any help, Stefan PS: The relvant code from BindingProvider is below (found at http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java?view=markup): /** * Check for maintain session state enablement either in the * MessageContext.isMaintainSession() or in the ServiceContext properties. * * @param mc * @param ic */ protected void checkMaintainSessionState(MessageContext mc, InvocationContext ic) { Map<String, Object> properties = ic.getServiceClient().getServiceContext().getProperties(); boolean bValue = false; if (properties != null && properties .containsKey(javax.xml.ws.BindingProvider.SESSION_MAINTAIN_PROPERTY)) { bValue = (Boolean) properties .get(javax.xml.ws.BindingProvider.SESSION_MAINTAIN_PROPERTY); } if (mc.isMaintainSession() || bValue == true) { setupSessionContext(properties); } } /* * Ensure that the next request context contains the session value returned * from previous request */ protected void setupSessionContext(Map<String, Object> properties) { String sessionKey = null; Object sessionValue = null; if (properties == null) { return; } if (properties.containsKey(HTTPConstants.HEADER_LOCATION)) { sessionKey = HTTPConstants.HEADER_LOCATION; sessionValue = properties.get(sessionKey); if (sessionValue != null && !"".equals(sessionValue)) { requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, sessionValue); } } else if (properties.containsKey(HTTPConstants.HEADER_COOKIE)) { sessionKey = HTTPConstants.HEADER_COOKIE; sessionValue = properties.get(sessionKey); if (sessionValue != null && !"".equals(sessionValue)) { requestContext.put(HTTPConstants.COOKIE_STRING, sessionValue); } } else if (properties.containsKey(HTTPConstants.HEADER_COOKIE2)) { sessionKey = HTTPConstants.HEADER_COOKIE2; sessionValue = properties.get(sessionKey); if (sessionValue != null && !"".equals(sessionValue)) { requestContext.put(HTTPConstants.COOKIE_STRING, sessionValue); } } else { throw ExceptionFactory .makeWebServiceException(Messages.getMessage("NoMaintainSessionProperty")); } if (sessionValue == null) { throw ExceptionFactory.makeWebServiceException( Messages.getMessage("NullValueForMaintainSessionProperty", sessionKey)); } } -- GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion! http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196
