Export (0) Print
Expand All

How to Create or Remove a Connector by Using the OMCF Web Service

System Center

Updated: May 22, 2009

Applies To: Operations Manager 2007 R2, Operations Manager 2007 SP1, System Center Operations Manager 2007

You can use the Operations Manager Connector Framework (OMCF) Web service to create a connector that allows Operations Manager to communicate with an external system.

noteNote
If the external system runs on a Windows-based computer, using the class libraries is the preferred method for creating the connector. For more information, see How to Create or Remove a Connector by Using the Operations Manager Class Libraries.

Example

The following example demonstrates how to create and remove a connector using the OMCF Web service. Before creating a connector, you can create an OMCF Web service proxy. For more information, see How to Create an OMCF Web Service Proxy.

/// <summary>
/// Creates and removes a new connector by using the OMCF Web service.
/// </summary>
using System;
using System.Collections.ObjectModel;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.ConnectorFramework;
using System.IO;
using System.Text;
using System.Xml;

namespace SDKSamples
{
    class Program
    {
        static void Main(string[] args)
        {
            ManagementGroup mg = new ManagementGroup("localhost");

            Guid connectorId = Guid.NewGuid();

            // Create a new connector.
            ConnectorInfo myConnectorInfo = new ConnectorInfo();
            myConnectorInfo.Name = "myConnector";
            myConnectorInfo.DisplayName = "My Connector";
            myConnectorInfo.Description = "This connector was created using the OMCF Web service.";

            // Define the Web service URI endpoint address for the Web service
            // that is used to create the connector.
            string uriEndpointAddress = "EnterURIEndpointAddressHere";
            ConnectorFrameworkProxy OMCFProxy =
                new ConnectorFrameworkProxy(uriEndpointAddress);

            OMCFProxy.SetupWithConnectorId(myConnectorInfo, connectorId);
            OMCFProxy.Initialize(connectorId);

            Console.WriteLine("Created " + myConnectorInfo.Name +
                " with ID: " + connectorId.ToString());


            // Remove the connector.
            Console.WriteLine("Removing connector with Id: " + connectorId);
            OMCFProxy.Uninitialize(connectorId);
            OMCFProxy.Cleanup(connectorId);
            Console.WriteLine("Connector removed.");

        }
    }
}

See Also

Show:
© 2014 Microsoft