You are here: Authorization > closeSession

Close Session

Description

Close the session and log out from EMS. This Web service is common for both vendor login and customer login.

Default Protocol Method Type URI
HTTPS POST closeSession.xml

Post Parameters

None

Sample Code

import java.io.IOException;
import org.apache.http.params.HttpParams;
public class EMSSample {
   private static DefaultHttpClient httpclient = new DefaultHttpClient();
   private static Principal principal = null;
   public static String closeSession.xml()throws Exception {
      if(!verifyLogin()){
         return "login failed";
      }
      HttpContext context = new BasicHttpContext();
      context.setAttribute(ClientContext.USER_TOKEN, principal);
      HttpPost post = new HttpPost("https://localhost:8443/ems/3.6/closeSession.xml");
      List<NameValuePair> nvps = new ArrayList<NameValuePair>();
      post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
      HttpResponse response = httpclient.execute(post, context);
      HttpEntity entity = response.getEntity();
      byte[] b = null;
      if (entity != null) {
         long l = entity.getContentLength();
         b = new byte[(int) l];
         entity.getContent().read(b);
         entity.consumeContent();
      }
      return new String(b);
   }
}

Sample Response

<?xml version=”1.0” encoding=”UTF-8”?>
  <emsResponse>
     <stat>ok</stat>
  </emsResponse>
See Also:

Output Format for Failure

Error Codes

Error Code Description
128 You should log on first.
1081 Invalid Web service version provided
1084 No Web service version provided
1088 The EMS system is running on HTTPS. Please provide the correct Web service URL.