You are here: Authorization > verifyLogin

Vendor Login


Use this method to log in to the EMS server and start a client session. A client application must log in and obtain a sessionId before making any other Web services calls.

When a client application invokes the verifyLogin method it passes in a user name and password as user credentials. Upon invocation, the EMS server authorizes the credentials and returns a sessionId for the session to use in all subsequent Web service calls.

Default Protocol Method Type URI


Post Parameters

Parameter Description Valid Values Optional
userName Login user name String No
password Login password associated with the specified user name String No

Sample Code

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 = "";

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 + "'");
    server = properties.getProperty("server");
    sslServer = properties.getProperty("sslServer");
    trustStore = properties.getProperty("trustStore");
    trustStorePass = properties.getProperty("trustStorePass");
    System.setProperty("", trustStore);
    System.setProperty("", trustStorePass);
public static boolean verifyLogin() throws Exception{
    HttpContext context = new BasicHttpContext();
    HttpPost post = new HttpPost(
    List<NameValuePair> nvps = new ArrayList<NameValuePair>();
    	nvps.add(new BasicNameValuePair("userName", "admin"));
    	nvps.add(new BasicNameValuePair("password", "admin"));
    	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];
    	principal = (Principal) context
    	String loginResult = new String(b);
    	if (loginResult.indexOf("\"stat\":\"ok\"")>0)
    		return true;
    	return false;

Sample Response

<?xml version=”1.0” encoding=”UTF-8”?>
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.
132 The URL address does not exist.
213 User name cannot be blank.
214 Password cannot be blank.
215 Either username or password is incorrect.
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.