Querying COM+ through Web Services


The most COM+ common administrative tasks (creating a COM+ application, installing/deleting a component, setting a component attribute) can be accomplished manually with the Component Services administrative tool from Management Console. But there a few cases (installing the components or changing a components value on a regular basis) when it is necessary to have programmatic access to the COM+ applications, components and interfaces. And in another few cases is needed to perform these operations without having access to MMC (remote computers without TerminalServicess rights or low bandwidth). Thats why I preferred to write a class which provides access to the most essential COM+ tasks and to expose this class through web services.

If you want to perform some action on the COM+ applications or components it is good to know which items (computers, applications, components or interfaces) are available. So in the first part Ill present the class and web service responsible with this duty. The structure of this first web service is:

  • GetComponents - retrieves every component for the specified application
  • GetApplications - retrieves every application
  • GetInterfaces - retrieves every interface for the specified component
  • GetComputers - retrieves the computers found in the Computers folder of the Component Services administration tool

The Component Services Administration (COMAdmin) Library is the point of access to the programmatic administration of the COM+. The (COM+ 1.0 Admin Type) library is distributed by default installation of the Windows 2000 in the %systemroot%\system32\com folder. To be able to use it you need to add a project reference to this library.



Now you can take a look at the COMAdmin library with Object Browser and you can notice three objects (ComAdminCatalog, ComAdminCatalogObject and ComAdminCatalogCollection). The first object is dealing with the reading and writing to the COM+ registration database (RegDB). All collections are structured into a single hierarchy. The ComAdminCatalog represents the root that contains the Application collection. The Application collection has as children the Components and the Roles collections. Access to these collections is a little unusual because you can not access a child collection without accessing the parent collection.

Ive tried to give almost the same tree structure to the XML results as in the COM+ Services administration tool for every web method.

Applications 

Components  

Interfaces  



The GetComponents and the GetInterfaces methods are adding at the top of the list the parents details (Application and Component) for a better vision.

The source code includes a class which is responsible for building the collections and a web service which is using the class for making it available outside so you have to add yourself a reference to the COMAdmin Type Library in your project.

Up Next
    Ebook Download
    View all
    Learn
    View all