How to invalidate hpsm session from java application for single user

We have integrated hpsm rest services with our web application. but it is allowing single user to open max 5 sessions at a time. each session is remains for 10 minutes in hpsm server. Please help us how to kill the session from java application (is there any service). It is very urgent please do the need full us to over come the problem.
Parents Reply Children
  • What if you:

    1.  Make the Java application single threaded
    2.  In the operator record, reduce the number of sessions to 1.
    3.  Implement the webservices_timeout parameter to 30 seconds. 

  • How to reuse  the session id to sub sequent requests obtained in first url connection of rest service in java. I have tried it with HttpUrlConnection api in java.

                  URL url = new URL("<HPSM Reset Service URl>");
                    con = (HttpURLConnection) (url.openConnection()); 
                  String authString = new StringBuffer(username).append(":")
                            .append(password).toString();
                    byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
                    
                    con.setConnectTimeout(40000);
                    con.setReadTimeout(40000);
                    con.setRequestMethod("GET");
                    con.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows 2000)");
                    con.setFollowRedirects(true);
                    con.setDoOutput(true);
                    con.setDoInput(true);
                    con.setUseCaches(false);
                    con.setAllowUserInteraction(false);
                    con.setRequestProperty("Content-Type", "application/json");
                    con.setRequestProperty("Authorization", "Basic " new String(authEncBytes));
                    String cookieId = con.getHeaderField("Set-Cookie"); // here i am getting (JSESSIONID=********, path = /sm )           

    and then i am trying ti reuse cookieId as following

       urlConn = (HttpURLConnection) (new URL("<HPSM Reset Service URl>).openConnection());
                    urlConn.setRequestMethod("GET");
                    urlConn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows 2000)");
                    urlConn.setFollowRedirects(true);
                    urlConn.setDoOutput(true);
                    urlConn.setDoInput(true);
                    urlConn.setUseCaches(false);
                    urlConn.setAllowUserInteraction(false);
                    urlConn.setRequestProperty("Content-Type", "application/json");
                    urlConn.setRequestProperty("Content-Language", "en-US");
                    urlConn.setRequestProperty("Cookie", cookie);

    But unfortunately i am getting unauthorised error. can any one help me on this to achieve session reuse.