Previous Topic: Retrieving AttributesNext Topic: Creating a Software Package


Finding a DSM Object

To request information or perform tasks on a DSM object, you must know its CA_MDB UUID. The DSM web service provides find functions that simplify this task, returning to you the string UUID of an object. Many object types such as users and computers can be found using just their display name. Other objects may need further information to enable the web service to perform the search.

Example 4: Finding a Computer by Name

String computerId = "";

//This method performs a search for the given computer name

private int findTargetComputer(String  computerName) throws Exception

{

             //Set the requested property (we are only interested in the UUID)

             ComputerPropertiesRequired props =

             new ComputerPropertiesRequired();

             props.setComputerUUIDRequired(true);

             //set up the output parameter

             LongWrapperHolder numFound = new LongWrapperHolder();

        
             ArrayOfComputerPropertiesHolder arrOfCompPropsHolder = new 				      ArrayOfComputerPropertiesHolder();

             //this may throw an axis fault

             wsAPIconnector.findComputer(service.getSessionId(),computerName, props, 		      arrOfCompPropsHolder, numFound );

             if(numFound.value.intValue() > 0)

             {

                   computerId = arrOfCompPropsHolder.value.getComputerPropertiesArray(0). 	      getComputerUUID();

              }

             else

             {

                   computerId = "";

                   return UDSMWebService.NO_MATCHING_COMPUTER;

             }

             return UDSMWebService.RESULT_OK;

}

This method demonstrates the request of required properties, and the retrieval of requested properties. The findComputer method, as with all DSM web service methods, may throw a SOAP/Axis exception.