Tutorial for the Client Example in Microsoft .NET Home | KEA

CXL

Cmap Web Service

Layout Web Service

Client Example

This page illustrates the use of the Client Example Application in Microsoft .NET 2.0. The source code for this example can be found at CmapWSClient.zip, and the binaries can be found at CmapWSClient.zip. You must have installed the Microsoft .Net Framework 2.0.

Starting the application

For starting the application you need to double click the CmapWSClient.exe file. You will get the following window:

Contacting a Cmap Web Service

You have to replace the server-address text, in the text box labeled "Web Service Address" by the address of the server you want to access. In our case, we have a Cmap Server running on the local machine, so we are going to use localhost as the server address. This address can be either an IP Address or a DNS name like cmapspublic.ihmc.us. If the server is not running on the default HTTP port (Port 80), you should specify the server port by appending a colon and the port number to the server address (cmapspublic.ihmc.us:8080).

A Cmap Server might have several web services, and for targeting a specific web service, we have to append an URL Path to the server address. In our case the path services/CmapWebService identifies the Cmap Web Service, and the path services/LayoutWebService identifies the Layout Web Service.

After typing the server address click on the "Go" button. If the server you are targeting is running and accessible and it has the web service running, the window should look something like this:

Browsing the Cmap Server

In the window just shown you must see a folder named "IHMC Test - Web Services". That is the name of our server, and it represents the root folder of the server we are accessing. If you click on the plus (+) symbol at the left of the folder icon you will get the list of resources in the root folder of the Cmap Server. In our case we only have two (2) resources: a Cmap named Plant, and a image with the same name. If you click in the image, the program will download the image and display it in the right side of the window, like this:



If you click in the Cmap, you will get the XML tree representing the Cmap in CXL:



This same map accessed from CmapTools looks like this:

Adding a resource

For adding a resource, you must right click in a folder and select the "Add Resource..." option in the pop-up menu that shows up:



Then you have to browse and select the resource you want to add, in our case we are going to add the file plant-example.jpg:



If you need permissions to write into the selected folder, you will be prompted for an user id and password:



After adding the resource you should see the new resource added under the folder that you initially selected, and if the Resource is an image or a Cmap you will see the resource displayed in the right side of the window:

Replacing a resource

The example of plant image that we just added is not exactly the kind of plant we are referring to in our Cmap, so we need to replace it by right clicking in the plant-example.jpg resource, and then selecting the "Replace Resource..." option in the pop-up menu that shows up:



Then you have to browse and select the resource you want for replacing the old resource, in our case we are going to use the file plant-example2.jpg:



After replacing the resource, if the Resource is an image or a Cmap, you will see it displayed in the right side of the window:

Deleting a resource

Now, we have decided to remove the resource just added by right clicking in the plant-example.jpg resource, and then selecting the "Delete" option in the pop-up menu that shows up:



After deleting the resource you will notice that it has been removed from the folder that contained it:

Adding a folder

For adding a folder you must right click in folder where you want to add the new folder and select the "Add Folder..." option in the pop-up menu that shows up:



Then, you will be prompted to enter a name for the folder:



After selecting "OK" in the dialog, and assuming that the folder doesn't already exist and that you use valid characters for the folder name, you should see the new folder added to the folder that you initially selected:



Now we can add resources to this folder:



Deleting a folder

To delete a folder you just need to right click over the folder you want to delete and select the "Delete" option in the pop-up menu that shows up:



After deleting the folder you will notice that it has been removed from the folder that contained it:

Laying out a Cmap

For laying out a Cmap, using the Layout Web Service, you must right click over the Cmap that you want to lay out and then select the "Layout..." option of the pop-up menu that shows up:



Then, you will be prompted for the Layout Web Service address:



The same rules for the Cmap Web Service address apply here, though you don't need to point to the same server that contains the Cmap Web Service, you could decide to use a different Layout Web Service in a different server. After entering the address, and assuming that Layout Web Service is available in the server you are targeting, the Cmap will be saved back to the server. If you use CmapTools to display the map, it might look like this: