- Build a lightweight mobile framework for Maximo: Getting started
- Build a lightweight mobile framework for Maximo: Create a Work Order
- Build a lightweight mobile framework for Maximo: Change Status of a Work Order using REST API
Choosing a Mobile Framework
I’ve already gotten my foot wet by reading up on some of jQM’s documentation so now we can start building our app. So the first step is to create a basic login page. Something simple for a user to enter his credentials and to authenticate with Maximo. Here is our login page (all code samples can be viewed at the end of the post):
So now that we have that, the tough part is to figure out a way to authenticate with Maximo. As you may know, Maximo REST API doesn’t come with a login API so we will have to come up with a hack or a work around to authenticate the user. Provided we are mainly building a small mobile app for technicians to create a new work order, we can make a request to the MAXUSER object. For the most part, you may not want a person to view this data, but this is the only MBO object that I can think of that virtually every user in Maximo will have access to. So we can use this object to authenticate the user. The basic idea here is that if the request doesn’t fail, you will assume that the login was successful. This is a work around, but it works for what we need it to do.
If you are not familiar with Maximo REST API, then you can read more on it here. For the REST URL we are going to use it will look just like this:
This URL is what we will use in our form’s action attribute, then we will complete the URL right before we call it an append the “_lid” and “_lpwd” variables with the users name and password. If the request is a success, we will then use jQM to load a new page into the view which will be our mobile start center page. Our start center page doesn’t do anything, but that will come later in the series.
Here is the complete code sample:
Running The Code Sample
First, copy and paste this code into your text editor like NotePad and save the file to something like “mobile.html”. Be sure to edit the server IP address to your own Maximo 7.5 server instance. Now you cannot run this file directly on your desktop because you will get a cross site scripting error. To properly run this file, go to your Maximo WebSphere application server and navigate to this directory:
This is where your Maximo web files are located. Create a new folder called “mobile” and paste your “mobile.html” file in this new directory. Once you have it in there, you can now open your browser and connect to you mobile app. Just simply enter this url:
Now you should be able to login with your Maximo credentials (provided you are NOT using LDAP, because Maximo REST only works with native authentication) and see the mobile start page.