# WCF Client

{% hint style="warning" %}
**Limited Support/End of Life Capabilities**

The Classic API has been replaced by the Alemba RestFul API.  While we will continue to support the Classic API for clients that are still using it, no further development will be done.

If you need to request a hotfix or support for these features, please contact [<mark style="color:blue;">**Alemba Support**</mark>](https://alemba.help/production/Portal.aspx)
{% endhint %}

**This end point is in the location**&#x20;

```
http://<machinename>/<VirtualDirectory>/ServiceManager.svc
```

To access this end point, you must create a WCF client and add it to your web application.

This section outlines the relevant steps which you can undertake to create a WCF client, and use this in a third party application to access the API. All examples have been created using Microsoft Visual Studio and have been written in VB.NET.

### Prerequisites

In order to access the Classic API, you should make sure that .NET 4.5 or later is installed on the system on which you are building your third party application.

### Generating a Client Class

You can use the ServiceModel Metadata Utility Tool (svcutil.exe) to create a client class. This is the class which will be used to call the web service. The client class output consists of a configuration file and a code file. These need to be added to your third party application project.

To generate a client class, you must first:

* Set your environment variable to the Visual Studio compiler
* Use svcutil.exe to generate a client class.

#### Setting the Environment Variable

Before using svcutil.exe to generate a client class, Microsoft recommends that you set the Visual Studio compiler vcvarsall.bat batch file as an environment variable.

To do this, create a batch file (for example, myBatchFile.bat) that contains the following command:

`%comspec% /k ""c:\Program Files\Microsoft Visual Studio 9.1\VC\vcvarsall.bat"" x86`

The example above points to the Vsvarsall.bat location assuming a Microsoft Visual Studio 9.1 installation. If you are using a different instance of Microsoft Visual Studio, you should update the command above to point to the equivalent location of the Vcvarsall.bat batch file.

For more information on setting your environment variable for command line builds, see:

{% embed url="<http://msdn.microsoft.com/en-us/library/x4d2c09s(VS.80).aspx>" %}

#### Using Svcutil.exe to Generate a Client Class

Once you have set your environment variable, use Svcutil.exe to generate a client class. To do this, run the following from the command prompt:

`svcutil /t:code /language=VB /messageContract http://<machine_name>/<virtual_directory>/ServiceManager.svc /out:ISMAPI.vb /config:ISMAPI.config`

This will output the files ISMAPI.vb and ISMAPI.config; these files contain the client class. You can change these to your required output names.

For more information on using svcutil.exe including an explanation of options, see:

{% embed url="<http://msdn.microsoft.com/en-us/library/aa347733.aspx>" %}

### Adding Client Class Files

You should have two output files:

* A configuration file
* A code file

#### Output Configuration File

For the output configuration file (ISMAPI.config using the above example), find the \<System.ServiceModel> section and add this to your web.config / app.config configuration with the correct endpoint address.

The endpoint address is in the format: `http://<machine_name>/<virtual_directory>/ServiceManager.svc`

#### Output Code File

For the output code file (ISMAPI.vb using the above example), make sure you add this to your third party application project. If you are creating a web application using Visual Studio 2008, this will be under the App\_Code section.

### Creating Client and Access API

From the third party application project, use the client class to create the code that will access the Classic API.

#### Example Login

The following VB.NET example demonstrates how to create a Service Client and log into the application using the ASM LogIn Transaction.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.alemba.com/asm-hermes/setup-and-configure-asm/faq/limited-support-end-of-life-capabilities/alemba-classic-api/programming-with-the-classic-api/wcf-client.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
