IBM Support

Building custom agent to run SOAP queries on TEMS

Technical Blog Post


Abstract

Building custom agent to run SOAP queries on TEMS

Body

One of my customer was interested to obtain some data from TEMS, so he  asked me a suggestion about how
to build a custom agent, using Agent Builder to execute GET requests from SOAP server available in the HUB Tems.

I spent some time on it before responding and I thought it worth to share with you the lesson learned.

First of all, in order to test the wanted SOAP query, I suggested him to use the "CT_SOAP Generic SOAP Client" available at URL:

 

http://<hub-tems>:1920///cms/soap

 

image

Using this soap client you can test your SOAP queries before using them with the custom agent.
Anyway, I noticed that this web client shows inconsistent behavior:


when you select the wanted method, for example "Get Object CT Method", the four fields below should be automatically populated, but this does not always occur.

After some test I understood this strictly depends on the browser settings.
Using Firefox, the problem is more evident.
If you instead use Internet Explorer, the problem can be easily avoided by enabling  "Access Data Sources Across Domains".

You can do it by navigating from Internet Options, tab Security, Custom level, Miscellaneous.

 

image

There is an additional issue you may experience:

The endpoint field is filled with localhost instead of the actual SOAP server hostname (the TEMS hostname)
 
So, in the Endpoint field, the string:

http://localhost:1920///cms/soap

 
must be changed to:


http://<actual_TEMS_hostname_or_IP>:1920///cms/soap

 
After this, the SOAP requests will work just fine.

To run a test, I used the CT_Get with object ManagedSystem, and it returned the list of Managed System Nodes registered on this HTEMS with all the related information.

 

image

So let's suppose we want to run the same SOAP query within a custom agent.
How can we use Agent Builder to build a custom agent that performs SOAP requests like this one ?

In order to create a custom agent and run the SOAP queries, we need to find a way to submit the CT_GET method.
After having selected SOAP datasource, you may think GET method is the needed option to run your queries, but this is indeed wrong.
In order to interact with TEMS, you need to provide a payload that includes proprietary methods like CT_GET, CT_Alert, CT_Acknowledge etc
plus some other info.

This can be done by passing the payload through POST method.

So the correct sequence within Agent Builder tool will be:

0) Create a new Agent

1) Add a new datasource, select SOAP

2) Specify TEMS hostname and port 1920 in the URL field.

3) Click Browse button and complete the URL field with:

http://<tems_hostname>:1920///cms/soap

4) select POST and fill the query field with input envelope

(eg <CT_Get><object>ManagedSystem</object></CT_Get>)

 

5) Click Connect and expand to the row level, then select one of the ROW and click add Button in the Agent Attributes section.
Those are the attributes that the custom agent will retrieve and show from the SOAP query.

image

6) Click OK to go back to "SOAP Information" panel.
Now Test button is enabled and from here you can try the query and look at the data returned by the query.


image

 

In the picture above I have removed IP addresses and hostnames from the query output, but the query worked fine and returned all the expected information.

This is the output of the CT_Get executed on object "ManagedSystem", so basically it is the same of tacmd listSystems.
Of course you can remove the unwanted columns and/or play with the attributes to obtain the result you want.
When you are satisfied with the layout, you can build your custom agent and deploy it to the target machine.

 

Thanks for reading.

 

Tutorials Point

 

Subscribe and follow us for all the latest information directly on your social feeds:

 

 

image

 

image

 

image

 

 

  

Check out all our other posts and updates:

Academy Blogs:https://goo.gl/U7cYYY
Academy Videos:https://goo.gl/TLfMoF
Academy Google+:https://goo.gl/HnTs0w
Academy Twitter :https://goo.gl/AhR8CL


image

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"","label":""},"Component":"","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}}]

UID

ibm11085187