You are here: Authorization > loginByEID

Customer Login By EID

Description

You can use this Web service in your application to configure login by entitlement ID (EID) for your customers/end users. The output are session id and entId.

On login by EID, a customer can view details of only one entitlement, the EID of which has been used for login. For a complete list of operations that the customer can perform after login, refer to Sentinel Cloud EMS User's Guide.

Default Protocol Method Type URI
HTTPS POST loginByEID.xml

Post Parameters

Parameter Description Valid Values Optional
eid

Specify the EID to login to EMS.

Please note that EID and EntId are different.

  • EID: It is a globally unique identifier assigned to a newly created entitlement. This EID can be used by end users for EMS login (if configured). You can view EID for a given entitlement on EMS GUI, for example on View Entitlement Certificate screen.
  • EntId: It is the web service handle returned on the successful creation of an entitlement. This handle can be used for calling other web services related to entitlement management.
String No

Sample Code

import java.io.IOException;
import java.io.InputStream;
import java.security.Principal;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.protocol.ClientContext;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HTTP;
import org.apache.http.protocol.HttpContext;
import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
public class EMSSample
{
   private static DefaultHttpClient httpclient = new DefaultHttpClient();
   private static Principal principal = null;
   private static String server;
   private static String sslServer;
   private static String trustStore;
   private static String trustStorePass;
   private static String emsWSDemoFile = "emsWSDemo.properties";
   public static void loadPropertiesFile() throws Exception
   {
      Properties properties = new Properties();
      InputStream file = Thread.currentThread().getContextClassLoader()
      .getResourceAsStream(emsWSDemoFile);
      if (file == null)
      {
         throw new Exception("unable to load file '" + emsWSDemoFile + "'");
      }
      properties.load(file);
      server = properties.getProperty("server");
      sslServer = properties.getProperty("sslServer");
      trustStore = properties.getProperty("trustStore");
      trustStorePass = properties.getProperty("trustStorePass");
      System.setProperty("javax.net.ssl.trustStore", trustStore);
      System.setProperty("javax.net.ssl.trustStorePassword", trustStorePass);
   }
   public static boolean loginByEID() throws Exception
   {
      loadPropertiesFile();
      HttpContext context = new BasicHttpContext();
      HttpPost post = new HttpPost("https://localhost:8443/ems/3.6/loginByEID.xml");
      List<NameValuePair> nvps = new ArrayList<NameValuePair>();
      nvps.add(new BasicNameValuePair("eid", ""));
      post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
      HttpResponse emsResponse = httpclient.execute(post, context);
      HttpEntity entity = emsResponse.getEntity();
      byte[] b = null;
      if (entity != null)
      {
         long l = entity.getContentLength();
         b = new byte[(int) l];
         entity.getContent().read(b);
         entity.consumeContent();
      }
      principal = (Principal) context.getAttribute(ClientContext.USER_TOKEN);
      String loginResult = new String(b);
      if (loginResult.indexOf("\"stat\":\"ok\"") > 0)
         return true;
      else
         return false;
   }
}

   

Sample Response

<?xml version=”1.0” encoding=”UTF-8”?>
<emsResponse>
   <entId>30</entId> 
   <sessionId>1634C549EFAA400C5C5737062457B7D9</sessionId> 
   <stat>ok</stat>
</emsResponse>
See Also:

Output Format for Failure

Error Codes

Error Code Description
100 Invalid request parameter.
107 An internal error occurred! Please report the error to System administrator.
122 {field} is a required field and should have a not null value. [Note: This error code is applicable for the fields - Eid, namespaceName, featureName, startDate, endDate, userIds, featureId, productName, productVersion, detailsLM, lmId, templateType, customAttribute, lineItemId, customerRefId, granularity, loginId, oldPassword, and newPassword.]
132 The URL address does not exist.
621 Entitlement does not exist. Retry with a correct ID.
650 eid cannot be null.
656 Entitlement not yet started, please contact administrator.
657 Entitlement expired, please contact administrator.
658 Entitlement is not in complete state, please contact Administrator.
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.