다음을 통해 공유


How to Create an OMCF Web Service Proxy

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

Before you can create a connector by using the Operations Manager Connector Framework (OMCF) Web service, you must create a Web service proxy. The proxy allows you to use the methods and types that are exposed by the Web service in your client application.

You can create an OMCF Web service proxy by using the Service Model Metadata Utility Tool (SvcUtil.exe) that is included in the Windows SDK. For more information, see the tool documentation (https://go.microsoft.com/fwlink/?LinkId=72777).

Note

You do not need to create a Web service proxy if you are accessing the OMCF by using the Operations Manager class libraries.

To create an OMCF Web service proxy

  1. Start a command prompt session.

  2. Navigate to the directory where you want to place the proxy code.

  3. Use the command-line tool SvcUtil.exe with the appropriate switches to create the proxy code. The following example generates a C# code file and configuration file for the OMCF service running on the localhost:

    Svcutil /language:c# /config:app.config https://localhost:6272/ConnectorFramework?svc
    
  4. Add the code and configuration files that are generated by the utility to your client application.

  5. Open the configuration file that is generated by the SvcUtil.exe tool.

  6. Under the system.serviceModel section, and find the endpoint element. The following example has one endpoint defined:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <system.serviceModel>
            <bindings>
                <wsHttpBinding>
                    <binding name="WSHttpBinding_IConnectorFramework" closeTimeout="00:01:00"
                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                        bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                        maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                        allowCookies="false">
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                        <reliableSession ordered="true" inactivityTimeout="00:10:00"
                            enabled="false" />
                        <security mode="Message">
                            <transport clientCredentialType="Windows" proxyCredentialType="None"
                                realm="" />
                            <message clientCredentialType="Windows" negotiateServiceCredential="true"
                                algorithmSuite="Default" establishSecurityContext="true" />
                        </security>
                    </binding>
                </wsHttpBinding>
            </bindings>
            <client>
                <endpoint address="https://localhost:6272/ConnectorFramework"
                    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IConnectorFramework"
                    contract="IConnectorFramework" name="WSHttpBinding_IConnectorFramework">
                    <identity>
                        <servicePrincipalName value="host/mycomputer.mydomain.com" />
                    </identity>
                </endpoint>
            </client>
        </system.serviceModel>
    </configuration>
    
  7. Copy the name attribute value to the clipboard. Use this value when you construct the Web service proxy in your client application, as shown in the following code:

    ConnectorFrameworkClient OMCFProxy = new ConnectorFrameworkClient("WSHttpBinding_IConnectorFramework");
    

    The constructed proxy (in this example, OMCFProxy) can now be used to access the methods and types in the OMCF.

    Important

    Your client application must include references to the .NET Framework 3.0 libraries System.ServiceModel.dll and System.Runtime.Serialization.

  8. When you are finished with the proxy, close the connection to the client application as shown in the following code:

    OMCFProxy.Close();
    

See Also

Tasks

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