Sample Java and JSP code
Follow the steps below for executing the Java code
1. Create a directory. For example C:\EMAPIJava
2. Copy the APIConfig.java and EMAPI.java files into that directory
3. Copy files login.xml, logout.xml, logoutAll.xml, userquery.xml and devicequery.xml into any location as desired
4. Make changes in APIConfig.java according to your setup. Please follow the comments provided in the file to make your changes
5. Use javac (or any other utility) to compile the APIConfig.java and EMAPI.java files
6. Execute EMAPI class
Follow the steps below for executing the JSP code
1. Create a directory. For example C:\EMAPIJsp
2. Copy the file EMTool.jsp into the directory
3. Create a folder named WEB-INF inside C:\EMAPIJsp
4. Copy the file web.xml into the WEB-INF folder
5. Use jar (or any other utility) to create a Web Application Resource (WAR) file as specified below
jar -cvf <WAR_file_name> EMTool.jsp WEB-INF
6. Copy the WAR file into the web application deployment directory of tomcat server (or any other web server installed)
7. Use the browser to invoke the jsp using
http://<web-server-ip>:port/<WAR_file_name>/EMTool.jsp
File containing the XMLs
| API | Filename |
|---|---|
| 1. Login API | login.xml |
| 2. Logout API | logout.xml |
| 3. LogoutAll API | logoutAll.xml |
| 4. UserQuery API | userquery.xml |
| 5. DeviceQuery API | devicequery.xml |
Java code using the EM API
| Description | Filename |
|---|---|
| 1. Config File | APIConfig.java |
| 2. Main File | EMAPI.java |
JSP Code using the EM API
| Description | Filename |
|---|---|
| 1. WEB XML FILE | web.xml |
| 2. JSP File | EMTool.jsp |