UCMDB and UD Practitioners Forum (Previously CMS)
cancel

UCMDB- Web Service API for getting list of CIType from the UCMDB

Highlighted
Varun Singh
Regular Collector

UCMDB- Web Service API for getting list of CIType from the UCMDB

Hello,

I am looking for a Java program to call web service API of UCMDB 8.02. If anyone has any inputs on this. Please share.

I am attaching my java program but this seems to be not working as it's not giving me any results.

Thanks
Varun Singh

 

P.S. This thread has been moved from Application Perf Mgmt (BAC / BSM) Support and News Forum to CMS and Discovery Support and News Forum. -HP Forum Moderator

Arguing with a fool, proves there are two
3 REPLIES
Amit Erental
Honored Contributor

Re: UCMDB- Web Service API for getting list of CIType from the UCMDB

Hi,

You have some examples related to query the CMDB class model (CI types and relations).

have a look at "Class Model Example" in the UCMDB web service API help,and at "Query the UCMDB Class Model"

From a quick look at your code, you are trying to get CI Instances by type, which means query the model, and not the class model. plus, the GetCIsByTypeResponse object should be returned from the stub and request, not created by new. example for this kind of operation also exist in the docs.

Hope this help,

Amit
Varun Singh
Regular Collector

Re: UCMDB- Web Service API for getting list of CIType from the UCMDB

Hi Amit,

following is an example of getCIsByType
-------------
public void getCIsByTypeDemo() {

GetCIsByType request = new GetCIsByType();

//set cmdbcontext

CmdbContext cmdbContext = getContext();

request.setCmdbContext(cmdbContext);

//set CIs type

request.setType("anyType");

//set CIs propeties to be retrieved

CustomProperties customProperties = new CustomProperties();

PredefinedProperties predefinedProperties =

new PredefinedProperties();

SimplePredefinedProperty simplePredefinedProperty =

new SimplePredefinedProperty();

simplePredefinedProperty.setName

(SimplePredefinedProperty.nameEnum.DERIVED);

SimplePredefinedPropertyCollection

simplePredefinedPropertyCollection =

new SimplePredefinedPropertyCollection();




simplePredefinedPropertyCollection.addSimplePredefinedProperty

(simplePredefinedProperty);

predefinedProperties.setSimplePredefinedProperties

(simplePredefinedPropertyCollection);

customProperties.setPredefinedProperties(predefinedProperties);

request.setProperties(customProperties);

try {

GetCIsByTypeResponse response =

getStub().getCIsByType(request);

TopologyMap map =

getTopologyMapResultFromCIs

(response.getCIs(), response.getChunkInfo());

} catch (RemoteException e) {

//handle exception

} catch (UcmdbFaultException e) {

//handle exception

}

}


It is an example of the getCIsByType usage.
---------------------------------------------

The following statment inside the TRY BLOCK doesn't evaluate to anything. There is no method in the client stubs which take the input as "request". like getCIsByType(request), also getstub doesn't have any method inside the defination to call this.

GetCIsByTypeResponse response =
getStub().getCIsByType(request);

--------------------------------------------

Did one have called the Web Service API for getCIsByType in HP UCMDB 8.02 cP5 version
Arguing with a fool, proves there are two
Amit Erental
Honored Contributor

Re: UCMDB- Web Service API for getting list of CIType from the UCMDB

Hi,

Please attach the full code and the exception
//Add this to "OnDomLoad" event