Keep-Alive example for Service Manager

The following shows an example of the code for using Keep-Alive with Service Manager.

================================================================
client request:
POST /SM/7/ws HTTP/1.1
accept: application/xop+xml, text/xml image/gif, image/jpeg, *; q=.2, 
*/*; q=.2
authorization: Basic ZmFsY29uOg==
soapaction: "Create"
connection: Keep-Alive
.....

SM server response:
HTTP/1.1 200
Set-Cookie: JSESSIONID=ED61093038F9FF8CE9CF44E34C9366AC; Path=/SM
Keep-Alive: timeout=1200000, max=1000
Connection: Keep-Alive
Content-Type: text/xml;charset=utf-8
Content-Length: 2112
.....

 

Then you need to echo back the JSESSIONID for each client use the following:

POST /SM/7/ws HTTP/1.1
accept: application/xop+xml, text/xml image/gif, image/jpeg, *; q=.2, 
*/*; q=.2
authorization: Basic ZmFsY29uOg==
soapaction: "Retrieve"
connection: Keep-Alive
cookie: JSESSIONID=ED61093038F9FF8CE9CF44E34C9366AC; Path=/SM;
....
================================================================

 

Note If you use Axis2 to implement the client then Axis2 can maintain the session by calling the setManageSession(true).

There is an Axis2 example in SM711 installation directory:

(...\Server\webservices\sample\sm7webservices\Axis2Sample)