Partager via


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

Applies To: System Center 2012 - Operations Manager

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

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

Note

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

Tasks

How to Create or Remove a Connector by Using the Operations Manager Class Libraries
How to Create an OMCF Web Service Proxy

Concepts

Using Operations Manager Connectors