๐Ÿ  Home > ๐Ÿ’ป Code Examples > โš™๏ธ C# Client

C# Client Implementation

Installation

Using Service Reference

# In Visual Studio
# Right-click on project -> Add -> Service Reference
# Enter WSDL URL: https://mentor.web.moneyStatHQ.asmx?WSDL

Using .NET CLI

dotnet tool install --global dotnet-svcutil
dotnet svcutil https://mentor.web.moneyStatHQ.asmx?WSDL

Complete Client Class

using System;
using System.Security.Cryptography;
using System.Text;

public class StatHQClient
{
    private readonly StatHQ _service;
    private readonly string _serviceName;
    private readonly string _secret;

    public StatHQClient(string serviceName, string secret)
    {
        _service = new StatHQ();
        _serviceName = serviceName;
        _secret = secret;
    }

    private string CreateSign(string plan)
    {
        using (var sha256 = SHA256.Create())
        {
            var bytes = Encoding.UTF8.GetBytes(plan + _secret);
            var hash = sha256.ComputeHash(bytes);
            return Convert.ToBase64String(hash);
        }
    }

}

## Usage Example

```csharp
class Program
{
    static void Main()
    {
        var client = new StatHQClient("YourService", "YourSecret");

        // No methods with [WebMethod] attribute found
    }
}

โฌ…๏ธ Back to Code Examples | ๐Ÿ  API Overview | ๐Ÿ“Š Data Types

results matching ""

    No results matching ""