次の方法で共有


Programming Using the Service Management Automation Web Service

You can use any programming language or scripting language to use the Service Management Automation web service as long as it has the ability to send an HTTP request and receive its response.

Programming in Visual Studio with the Service Management Automation Web Service

If you are using Visual Studio to create your application using the Service Management Automation web service, you can add a Service Reference to your project which allows you to work with the web service without the complexities of building the HTTP requests. With a service reference added to your project, you start your code by creating an OrchestratorContext object. This object provides you access to all of the collections and entries provided by the Service Management Automation Web service. See the code samples in this section for examples of how to use the service reference and the OrchestratorContext object.

To add a service reference to a Visual Studio project

  1. In Solution Explorer, right-click the name of the project that you want to add the service to, and then click Add Service Reference.

  2. In the Address box, enter the URL for the Service Management Automation web service, for example https://server1.contoso.com:9090/00000000-0000-0000-0000-000000000000. If your current user account doesn’t have access to Service Management Automation then you may be prompted for a username and password.

    Note

    The current version of Service Management Automation uses a GUID value of 0 (00000000-0000-0000-0000-000000000000) as the tenant identifier for all SMA requests.

  3. Click Go.

  4. In the Namespace box, enter the namespace that you want to use for the reference, for example SMAService.

  5. Click OK.

Note

In the Add Service Reference dialog box, under Services, the OrchestratorApi will be listed. OrchestratorApi is the correct service to select for Service Management Automation.

Important

For instructions on adding a Visual Studio service reference for the Service Management Automation JobStreams Web service, see Importing the JobStreams Metadata File.

Scripting With the Service Management Automation Web Service

Scripts written in such languages as Windows PowerShell and VBScript do not have the ability to use a service reference like in Visual Studio. You must explicitly construct the URL to perform the query or action that you want to perform and include it in an HTTP request. You use a GET request method to retrieve data from the Service Management Automation Web service and a POST request method to update data. Data is returned in XML according to the AtomPub standard, and you must provide logic in your script to parse and interpret this information.

See Also

Concepts

OData Queries Using the Service Management Automation Web Service
Authentication and Authorization
Service Management Automation Web Service Fundamentals