Highlighted
New Member.
991 views

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.
0 Likes
6 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to invalidate hpsm session from java application for single user

Couple of ideas:

1.  There is a webservices timeout parameter you could put in the sm.ini to help kill those old sessions

2.  If it's just a single operator that is used for this integration, you could go into that Operator record and set the unlimited sessions checkbox, which would remove the Max 5 issue.

0 Likes
Highlighted
New Member.

Re: How to invalidate hpsm session from java application for single user

Hey Tom, thanks for your quick reply.

I agree with you, but we  have only one user with 7 sessions, if it exceeds we are getting exception. now we have to handle 30 concurrent users. We are using Java to connect hpsm rest service with httpurlconnection. do u have any idea how to achieve the above scenario.

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to invalidate hpsm session from java application for single user

I don't understand.  Why can't you use the webservice timeout parameter to kill each session after 60 or 90 seconds and if that doesn't work for you, why can't you give your operator unlimited sessions instead of just 7?

0 Likes
Highlighted
New Member.

Re: How to invalidate hpsm session from java application for single user

We got only 7 users to login into hpsm at a time, When there is more userd want to access it. how can we use 7 users effectively with mulitple sessions.

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How to invalidate hpsm session from java application for single user

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. 

Highlighted
New Member.

Re: How to invalidate hpsm session from java application for single user

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.

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.