I have limit of maximum two concurrent login from a user in application. I want to terminate the session after the soap webservice request but my session is not terminating. I have tried different ways but did not get any success.
How should I set the keep alive header so that after the web service call the session get end.
public class CallDropIncidentDataClient {
private static com.hp.schemas.sm._7.CallDropIncidentManagement getPaymentServicePort() {
URL url = null;
try {
url = new URL(AppConfig.getProperty("Wsdl_CDIncidenManagement_Url"));
} catch (MalformedURLException ex) {
}
QName qName = new QName(AppConfig.getProperty("Wsdl_CDIncidenManagement_Namespace"), AppConfig.getProperty("Wsdl_CDIncidenManagement_Name"));
com.hp.schemas.sm._7.CallDropIncidentManagement_Service service = new com.hp.schemas.sm._7.CallDropIncidentManagement_Service(url, qName);
com.hp.schemas.sm._7.CallDropIncidentManagement port = service.getCallDropIncidentManagement();
// Map<String, Object> req_ctx = ((BindingProvider) port).getRequestContext();
// req_ctx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, AppConfig.getProperty("Wsdl_CDIncidenManagement_Url"));
//req_ctx.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, false);
// Map<String, List<String>> headers = new HashMap<String, List<String>>();
Map<String, List<String>> headers = new HashMap<String, List<String>>();// ((BindingProvider) port).getRequestContext();
// headers.put("username", "xx");
// headers.put("password", "xxxx");
headers.put("Connection", Collections.singletonList("Keep-Alive"));
headers.put("keep-alive", Collections.singletonList("timeout=1000"));
//
//System.getProperties().put("http.keepalive", "false");
//String requestTimeout = "1000";
BindingProvider prov = (BindingProvider)port;
prov.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "xx");
prov.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "xxx");
prov.getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, 2000);
// prov.getRequestContext().put("com.sun.xml.ws.request.timeout", requestTimeout);
prov.getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS, headers);
prov.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.FALSE);
prov.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, AppConfig.getProperty("Wsdl_CDIncidenManagement_Url"));
return port;
}
public static CloseCallDropIncidentResponse closeCallDropIncident(com.hp.schemas.sm._7.CloseCallDropIncidentRequest closeCallDropIncidentRequest) {
com.hp.schemas.sm._7.CallDropIncidentManagement port = getPaymentServicePort();
return port.closeCallDropIncident(closeCallDropIncidentRequest);
}
public static CreateCallDropIncidentResponse createCallDropIncident(com.hp.schemas.sm._7.CreateCallDropIncidentRequest createCallDropIncidentRequest) {
com.hp.schemas.sm._7.CallDropIncidentManagement port = getPaymentServicePort();
return port.createCallDropIncident(createCallDropIncidentRequest);
}
public static RetrieveCallDropIncidentResponse retrieveCallDropIncident(com.hp.schemas.sm._7.RetrieveCallDropIncidentRequest retrieveCallDropIncidentRequest) {
com.hp.schemas.sm._7.CallDropIncidentManagement port = getPaymentServicePort();
return port.retrieveCallDropIncident(retrieveCallDropIncidentRequest);
}
public static RetrieveCallDropIncidentKeysListResponse retrieveCallDropIncidentKeysList(com.hp.schemas.sm._7.RetrieveCallDropIncidentKeysListRequest retrieveCallDropIncidentKeysListRequest) {
com.hp.schemas.sm._7.CallDropIncidentManagement port = getPaymentServicePort();
return port.retrieveCallDropIncidentKeysList(retrieveCallDropIncidentKeysListRequest);
}
public static RetrieveCallDropIncidentListResponse retrieveCallDropIncidentList(com.hp.schemas.sm._7.RetrieveCallDropIncidentListRequest retrieveCallDropIncidentListRequest) {
com.hp.schemas.sm._7.CallDropIncidentManagement port = getPaymentServicePort();
return port.retrieveCallDropIncidentList(retrieveCallDropIncidentListRequest);
}
public static UpdateCallDropIncidentResponse updateCallDropIncident(com.hp.schemas.sm._7.UpdateCallDropIncidentRequest updateCallDropIncidentRequest) {
com.hp.schemas.sm._7.CallDropIncidentManagement port = getPaymentServicePort();
return port.updateCallDropIncident(updateCallDropIncidentRequest);
}
}