Reader Level:
ARTICLE

Querying COM+ using Web Services in VB.NET

Posted by Daniel Stefanescu Articles | Visual Basic .NET November 10, 2012
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 component’s value on a regular basis) when it is necessary to have programmatic access to the COM+ applications, components and interfaces.
  • 0
  • 0
  • 2965
Download Files:
 

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 component's 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 TerminalServices's rights or low bandwidth). That's 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 I'll 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.

COM1-Vb.net.jpg

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.

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

COM2-Vb.net.jpg

COM3-vb.net.jpg

Applications 
 

COM4-Vb.net.jpg


COM5-Vb.net.jpg

Components 
 

COM6-Vb.net.jpg
  

COM8-Vb.net.jpg 

Interfaces
 

 COM9-Vb.net.jpg

 COM10-Vb.net.jpg

The GetComponents and the GetInterfaces methods are adding at the top of the list the parent's 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.

COMMENT USING

Trending up