You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

To use the LAC SOAP API, you need to write a client application that will send a proper request to the webservice and receive the response that the service sends back. With a programming language like C#, you can write this application in a matter of minutes using the steps below. After following these steps, which are the same for both Vendor and End-user SOAP APIs, you can easily send requests and receive responses from the service.

The following example shows setup for the Vendor SOAP API. This example uses Visual Studio 2010, which is only one option. 

1. To start using the LAC SOAP API, create an empty Console Application project in Microsoft Visual Studio 2010.

2. To auto-generate classes representing LAC data structures and Vendor SOAP API methods, right-click on your project in the Solution Explorer and select Add Service Reference... from the list.

3. To get the SOAP API reference, enter the proper URL for the wsdl file (for the Vendor SOAP API: https://license.x-formation.com/soap/type/vendor/version/1?wsdl; for the End-user SOAP API: https://license.x-formation.com/soap/type/enduser/version/1?wsdl). You can also change the Namespace to LACVendorAPI or LACEnduserAPI as appropriate. Click Go to auto-generate all required classes.

Vendor SOAP API example

For a Vendor SOAP API example, replace the Program.cs file with the one attached to this page. This example usage of the LAC Vendor SOAP API lets you remotely add new customers and create a new license order of an existing product in LAC. The only changes you need to make are to the credentials, the product and product template name, and the customer information.

Download file

Program.cs

End-user SOAP API example

The following code snippet implements license activation using SOAP API and the web service reference classes generated as described above.

using SoapClient.EnduserAPI;

...

static void Main(string[] args)
{
  string strActKey = "9EFJK-TVJM0-MCDET-EZKXJ";
  string strHostid = "HOSTNAME=my_hostname";
  LAC_EnduserPortClient Client = new LAC_EnduserPortClient();

  Soap_Response_License Response = Client.CreateLicenseRequest(strActKey, strHostid);

  if (Response.result_code != 0)
  {
    PrintResponse(Response);
    return;
  }

  do
  {
    Response = Client.GetLicense(strActKey, strHostid);

    if (Response.result_code != 1)
    {
      PrintResponse(Response);
      return;
    }

    Thread.Sleep(2000);
  }
  while (Response.result_code != 0);

  PrintResponse(Response);
}

static void PrintResponse(Soap_Response_License Response)
{
  Console.WriteLine("Result code: " + Response.result_code.ToString());
  Console.WriteLine("Result string: " + Response.result_string);
}
  • No labels