Publisher Login
Use this method to log in to the Sentinel LDK-EMS Server and start a client session. A client application must log on and obtain a sessionId before making any web services calls.
To call the login method, the client application needs to provide a user name and password in XML format. The Sentinel LDK-EMS Server authenticates the credentials and returns a session ID in response header to be used in subsequent calls.
Method Type | URI |
---|---|
POST | v90/ws/login.ws |
Sample Input (XML)
<?xml version="1.0" encoding="UTF-8"?> <authenticationDetail> <userName>admin</userName> <password>admin</password> </authenticationDetail>
The input/output XML comply with a common XSD schema. See XSD for Authentication Details.
Sample Response
HTTP Status Code: 200
Response Body:
<?xml version="1.0" encoding="UTF-8"?> <authenticationDetail> <userName>admin</userName> <version>x.x.x</version> </authenticationDetail>
Sample Code to Fetch Session ID from Response Headers
Session ID is returned in the response header (Set-Cookie). Following is a sample code to fetch the session ID from the response header.
DefaultHttpClient httpclient= new DefaultHttpClient(); StringEntity se = new StringEntity(inputString ,"UTF-8"); HttpContext localContext = new BasicHttpContext(); HttpPost httppost = new HttpPost(uri); httppost.setEntity(se); HttpResponse emsResponse = httpclient.execute(httppost,localContext); Header[] cookieHeader=emsResponse.getHeaders("Set-Cookie"); if(cookieHeader!=null && cookieHeader.length>0) { for(Header header:cookieHeader) { for(HeaderElement element:header.getElements()) { if(element.getName().equalsIgnoreCase("JSESSIONID")) { sessionId=element.getValue(); break; } } } }