aspose file tools*
The moose likes Web Services and the fly likes Session Management in web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Session Management in web service" Watch "Session Management in web service" New topic
Author

Session Management in web service

Nilesh Mishra
Greenhorn

Joined: Feb 16, 2012
Posts: 8
Hi,

I am trying to write web service code which able to maintain the same session on different request.

The code is as below:
Server code

Client code:

When i am executing the client code, the new session id get generated. but i want to maintain the same session for the certain period, so when next request will go, that request will share the existing session id not the new session. i search through blog, one of blog i found that they are using hashset for storing session id. but how we can retain session timeout value for certain timeinterval. i am new in a web service. guide me
Anand prakash
Greenhorn

Joined: Feb 28, 2012
Posts: 1
response1

<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address>
<wsa:ReferenceParameters>
<axis2:ServiceGroupId xmlns:axis2="http://ws.apache.org/namespaces/axis2">
urn:uuid:a2dfc341-e310-463c-80d0-cc1ac6d530a9 </axis2:ServiceGroupId>
</wsa:ReferenceParameters>
</wsa:ReplyTo>
<wsa:MessageID>urn:uuid:4081bc29-8347-4831-9642-598616313984
</wsa:MessageID>
<wsa:Action>//schemas.xmlsoap.org/wsdl/MTOMServicePortType/AttachmentResponse
</wsa:Action>
<wsa:RelatesTo>urn:uuid:2a5040b1-9f2b-49d4-b1c7-e75786a5a642
</wsa:RelatesTo>
</soapenv:Header>
<soapenv:Body>
<ns1:AttachmentResponse xmlns:ns1="http://ws.apache.org/axis2/mtomsample/">service
executed</ns1:AttachmentResponse>
</soapenv:Body>
</soapenv:Envelope>

response2:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address>
<wsa:ReferenceParameters>
<axis2:ServiceGroupId xmlns:axis2="http://ws.apache.org/namespaces/axis2">
urn:uuid:a2dfc341-e310-463c-80d0-cc1ac6d530a9
</axis2:ServiceGroupId>
</wsa:ReferenceParameters>
</wsa:ReplyTo>
<wsa:MessageID>urn:uuid:66cc6591-cd47-4c48-8878-6c3f416e1308
</wsa:MessageID>
<wsa:Action>//schemas.xmlsoap.org/wsdl/MTOMServicePortType/AttachmentResponse
</wsa:Action>
<wsa:RelatesTo>urn:uuid:9e959964-b82a-4f6c-a4ee-bd656a638237
</wsa:RelatesTo>
</soapenv:Header>
<soapenv:Body>
<ns1:AttachmentResponse xmlns:ns1="http://ws.apache.org/axis2/mtomsample/">service1
executed</ns1:AttachmentResponse>
</soapenv:Body>
</soapenv:Envelope>

I have copied here two different responses with same servicegroupId,Are you looking for the same.
Nilesh Mishra
Greenhorn

Joined: Feb 16, 2012
Posts: 8
Hi,

I am using websphere7.0 for client program and , i am getting the exception : javax.xml.ws.WebServiceException: Error: Maintain Session is enabled but none of the session properties (Cookies, Over-written URL) are returned. while if i am running the same client program from the console then i am receiving same session id. Please suggest me why in the browser level client program generating exception.
Brighton Mukorera
Greenhorn

Joined: Aug 07, 2013
Posts: 1
@Anand prakash what you described is exactly what I am looking for. Can you please assist.
Nilesh Mishra
Greenhorn

Joined: Feb 16, 2012
Posts: 8
@Brighton Mukorera can you give me details actually what are you looking for?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Management in web service