SALES: 1-800-867-1380

Creating .NET Applications Using TPM OM REST API

Updated: October 12, 2014

Because the TPM OM API is based on the OData protocol, you can use the WCF Data Services to create .NET applications that consume the data services exposed by the TPM OM. This topic provides instructions on how to create .NET applications to perform operations on the TPM OM entities, such as defining partners, creating agreements, and so on.

The following illustration captures a typical code flow for creating a .NET application to use the TPM OM REST API.

Typical code flow for using the REST API with .NET

To start creating .NET applications for consuming data services exposed by TPM OM API, you need to install Visual Studio 2012 and WCF Data Services 5.0.

  • Install Visual Studio from http://msdn.microsoft.com/library/dd831853.

  • Install WCF Data Services from http://www.microsoft.com/en-us/download/details.aspx?id=29306.

  • If you used a self-signed certificate while provisioning Microsoft Azure BizTalk Services, you must add that certificate to trusted certificate store on the computer where you use the TPM OM API. Otherwise, you get error - The underlying connection was closed: Could not establish "trust relationship for the SSL/TLS secure channel. You do not need to perform this step if you used a certificate from a trusted signing authority.

This section provides the broad set of instructions that you must follow to create a .NET application using the TPM OM REST API. The instructions in this section assume that you create a C# application.

  1. Create a Visual Studio C# project.

  2. In the project Solution Explorer, right-click References, and then select Add Service Reference.

  3. In the Add Service Reference dialog box, do the following:

    1. For the address, enter the URL where the TPM OM service metadata is hosted and select Go. A typical URL for metadata looks like:

      https://mybiztalkservice.biztalk.windows.net/default/$PartnerManagement
      

      In this URL, https://mybiztalkservice.biztalk.windows.net is your deployment URL, default is the default namespace, and $PartnerManagement is the endpoint suffix to retrieve the metadata.

    2. In the Namespace text box, enter a namespace, such as PartnerManagement.

    3. Select OK to add the reference to the Visual Studio project.

  4. In the .cs file, add a reference to the service namespace. For example, if the namespace for your C# project is BtsServices and the namespace for the service reference is PartnerManagement, add the following reference to your .cs file:

    using BtsServices.PartnerManagement;
    

    You can now start creating the entities, set their properties, and create relationships between the entities.

    ImportantImportant
    Whenever you commit changes to the service context, you must always use the Batch save option. You can either set this option once when you create the context by using the following:

    context.SaveChangesDefaultOptions = SaveChangesOptions.Batch;

    Or, you can use it every time you save changes to a context.

    context.SaveChanges(SaveChangesOptions.Batch);

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft