Hooking a Web Service into iManager
Novell Cool Solutions: Feature
By Shawn Holmstead
Digg This -
Posted: 28 Oct 2003
Update: Shawn Holmstead is a senior software engineer at Novell. If you have any questions about this article you may contact him at firstname.lastname@example.org
Novell iManager is very useful to manage many products and comes with many task plug-ins. However, you may want to manage a product that does not yet have a task plug-in. If the product already has a web interface, then you are in luck. You can create a custom task to automatically login to the product, and you can control access to the task through iManager's Role-Based Services (RBS) just like any other task.
Role Based Services is required
In order to hook any web service into iManager, the first thing you have to do is to install Role-Based Services (RBS). If you already have RBS installed, then go onto the next section.
- 1. To install RBS, select the "Configure" view, then select the "RBS Configuration" role, and finally select the "Configure iManager" task. You should be presented with the wizard to use to install RBS as shown in Figure 1.
- Select the "Create a new collection" and press "Next>>".
- Pick a container to install your collection into and press "Next >>".
- (Optional) You can assign a scope to the modules to limit where in eDirectory users can perform tasks. You can leave the scope blank to allow the tasks to be performed anywhere in the tree.
- Finally, press the "Start" button to begin installing RBS and creating your collection.
- The RBS Configuration Wizard will inform you when RBS is successfully installed.
Create a custom role for your tasks
You can put your custom tasks in any of the predefined roles that come with iManager, or you can create your own role in which to put your new tasks. For this document, we will create our own role to group our custom tasks.
- On the "Configure" view, select the "Role Configuration" role, and then select the "Create iManager Role" task. You should see the Create iManager Role Wizard as shown in Figure 2.
- Fill in the details for the "Role name," "Collection," and "Description" fields. You can use the "History" button to quickly select the collection you just created.
- Press "Next >>".
- On "Step 2: Choose the tasks," simply press "Next >>" to have no tasks assigned to this role.
- On "Step 3: Assign Members and Scopes," you can assign any users to be a member of this role.
- Press "Next >>" to assign members and scopes to your role.
- On the "Summary" page, press "Finish" to create your role.
Note 1: Since you created the collection of roles and tasks, you will automatically see all roles and tasks in your collection. You do not need to be assigned to each role and task. Other users will need to be assigned access to this role for them to be able to use it.
Note 2: Scope is unnecessary since the tasks in this role are custom tasks and do not need eDirectory rights. You can leave the scope blank.
Create your custom task
You now have everything necessary to create your custom task and hook the web interface of your choice into iManager. iManager has provided the "Create Server Administration Task" to hook web interfaces into iManager.
- On the "Configure" view, select the "Task Configuration" role, and then the "Create Server Administration Task" option as shown in Figure 3.
- Select the "Other" service type and press "Next >>".
- On the "Specify custom service URL" page as shown in Figure 4, enter the URL to get to the web interface. For this example, enter "http://www.myrealbox.com".
- You will now be presented with a wrapped view of the URL you just specified allowing you to provide credentials to the web service. All form parameters will be captured to allow a seamless login when the task is performed. For this example, you can specify "jbirdman" as the username and "novell" as the password as shown in Figure 5. Then press the "login" button on the MyRealBox login page.
- You will now be able to verify the actual service URL that will be used and any parameters needed to successfully authenticate to the service.
- Press the "Next >>" button to accept the service URL and parameters.
- Give the task a name and select the collection and role for the task as shown in Figure 7. Remember to use the "History" button to quickly select your collection and the custom role you just created.
- Press the "Finish" button to create your custom task.
Note: The "Create Server Administration Task" interfaces with the NetWare 6.5 Welcome Page and can read the .xml descriptors of the web interfaces that show up on the Welcome Page. If you run iManager on a NetWare 6.5 server, you will see many entries on the "Step 1: Choose a service type" page in addition to the "Other" service type displayed in Figure 3. If you choose one of these predefined services, all you generally have to do is tell the IP address or DNS entry of your server. However, the "Other" service type is always available (at the bottom of the list of service types) on all platforms to allow you to hook in any web interface into iManager.
Note 1: In Figure 6 below, you will notice that the service URL is different than the one you originally entered. What this means is that "http://www.myrealbox.com/" redirects to "http://mail.myrealbox.com/f" and iManager has captured the true URL for you. This is necessary because iManager needs to submit the parameters to the URL that contains the form, not the URL that simply redirects.
Note 2: You can see all of the parameters by selecting the "Parameters" edit box and using the arrow keys to scroll the contents left and right.
Note 3: In this example, the list includes password=novell and username=jbirdman parameters as they were entered along with all other parameters submitted by the web form. If you want all users of the task to login as jbirdman with password novell, then you do not need to change anything. If, however, you want each user to use their eDirectory credentials they used to login to iManager in the task, you can use portal macros to replace parameters and substitute values for the parameters. To do this, you would change the parameters to be:
Note 4: The order of parameters does not matter. The only requirement is that parameters are separated by the "&" character.
Using your task
You are now ready to use your task. Go to the "Roles and Tasks" view and find the custom role you created. In this example, we named the role "Web Interfaces." Select the custom role and you should see your custom task. In this example, we named it the "MyRealBox e-mail" task. Your view should look something like Figure 8.
Once you select your task, iManager will open a new browser window directed at the URL specified in the task and pass any parameters. With any luck, you should see a browser window that looks like Figure 9.
That's all there is to it! You can now create a custom task to any form-based web service.
What if my web service uses basic authentication instead of form authentication?
Basic authentication means that when you go to a web site your browser opens a dialog prompting you for credentials as shown in Figure 10, instead of presenting a form for you to fill in with your credentials.
Perhaps you want to create a custom iManager task to monitor a NetWare 5.1 server using the NetWare Management Portal. The NetWare Management Portal in NetWare 5.1 uses basic authentication instead of having you fill out a form.
The procedure for creating a custom task that uses basic authentication is identical to that of creating a custom task that uses form authentication, except that step 4 is skipped (presenting a wrapped view of the web site). On step 3, enter your custom URL pointing to the site, as shown in Figure 11.
After pressing "Next >>", you are immediately shown the "Confirm custom service settings" page with no parameters as shown in Figure 12. Note that the "Uses basic authentication" checkbox is checked.
If you leave the "Uses basic authentication" checkbox checked, then iManager will send the username and password used to login to iManager as the basic credentials (exactly the same as using the portal macros %portaluser% and %portalpass%).
If you want everyone using the custom task to use the same username and password, you need to uncheck the "Uses basic authentication" checkbox and simply supply the credentials directly in the "Service URL" field as shown in Figure 13. The basic username and password must preceed the IP or DNS address of the server and be separated by an "@" from the IP or DNS address of the server. The format for basic credentials is:
For the NetWare Management Portal, we must enter the basicuser with full DN, so our service URL becomes:
Press "Next >>" and complete the rest of the steps for creating a custom task.
What if I want to change a custom task I've already created?
Unfortunately, today there is no way to change a custom task once it has been created. The only thing you can do is to delete your custom task and start over.
To delete your custom task, go to the "Configure" view, select the "Task Configuration" role, and the "Delete Task" task. Make sure to use the "History" button to easily locate your custom task. Press "OK" to delete your custom task.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com