This section contains .NET API examples, including setting up the Vendor SOAP API and example usage of the Vendor and End User SOAP API.
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. You can also change the application name to VendorAPIExample or EnduserAPIExample as appropriate.
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.
Note: By default, the maximum size of the auto-generated SOAP binding received message is 65536. You should adjust this value as needed (for example, you may need to increase the maximum size for large license files) by setting the values of maxReceivedMessageSize and maxBufferSize binding parameters in the app.config file for the project. The set value should be identical for both parameters.
Using the SOAP API with a DLL
If you want to wrap the SOAP API in a reusable dynamic-link library (DLL) (for example, to create a licensing module for use by multiple applications), you must manually change your configuration.
The app.config file generated by .NET during service reference creation is used to configure settings for the SOAP API. These settings must be copied to the app.config file of the executable that uses the DLL to properly configure the application. To do this:
- Add an application configuration file to the executable project (Project > Add new item > Application Configuration File).
- Copy and paste the settings from the .NET-generated app.config file to the executable's app.config file.
The executable will then support the necessary settings to use the library.
Vendor SOAP API examples
The downloads in the table below provide examples of using the Vendor SOAP API.
This example shows how to 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.
This example shows how to retrieve customer and license order information. This type of program can also be used to synchronize LAC with external systems; for example, to send emails to customers when their license is nearing expiration.
End user SOAP API example
The download in the table below provides an example of using the End User SOAP API.
This example implements license activation using the SOAP API and the web service reference classes generated as described above.