Skip to main content

Hello World API

This tutorial will show how to create a myAvatar ScriptLink-compatible API with .NET 8.0.

Before You Begin

You will need the following to complete this tutorial:

When using Visual Studio you will want the following workloads and components installed.

  • ASP.NET and web development workload.
  • .NET 8.0 Runtime (if not already included with the install of the above workload)

Create Project

  1. Launch Visual Studio 2022.
  2. Create a new project.
  3. Select C# and then search for ASP.NET.
  4. Select ASP.NET Core Empty and then select Next.
  5. Configure your new project.
    1. Set your project name.
    2. Select the location to store your project.
    3. Set your solution name.
    4. Don't check Place solution and project in the same folder. we will be adding additional projects to this solution in other tutorials.
  6. Select Next.
  7. Set the Framework to .NET 8.0 (Long Term Support).
  8. Select Configure for HTTPS.
  9. Select Create.

Add Dependencies

We will add two NuGet packages to our project.

  1. Right-click on the soution in Solution Explorer and select Manage NuGet Packages for Solution....
  2. Select Browse and search for AvatarScriptLink. Select RarelySimple.AvatarScriptLink by Scott Olson Jr and install this in your project.
  3. Select Browse and search for SoapCore. Select SoapCore by Digital Design and install this in your project.
  4. Select the Install tab, clear the search text and confirm you now have two packages installed in your project.

Create the Service Contract

  1. Add a new class to your project named IScriptLinkService2015.
  2. Implement the GetVersion and RunScript operation contracts as shown below.
using RarelySimple.AvatarScriptLink.Objects;
using System.ServiceModel;

namespace ScriptLinkHelloWorldDemo
public interface IScriptLinkService
string GetVersion();

OptionObject RunScript(OptionObject optionObject, string parameter);
  1. Add a new class to your project named ScriptLinkService.
  2. Inherit this class from IScriptLinkService2015.
  3. Implement the GetVersion and RunScript methods as shown below.
using RarelySimple.AvatarScriptLink.Objects;

namespace ScriptLinkHelloWorldDemo
public class ScriptLinkService : IScriptLinkService2015
public string GetVersion()
return "0.1.0";

public OptionObject2015 RunScript(OptionObject2015 optionObject, string parameter)
return optionObject.ToReturnOptionObject(ErrorCode.Alert, "Hello World!");

Update Program.cs

In this step, we are going to replace the default "Hello World!" API with our new ScriptLink-compatible API.

  1. Open the Program.cs file.
  2. Update the file to include the following:
using Microsoft.Extensions.DependencyInjection.Extensions;
using SoapCore;

var builder = WebApplication.CreateBuilder(args);
builder.Services.TryAddSingleton<IScriptLinkService2015, ScriptLinkService>();
var app = builder.Build();

app.UseEndpoints(endpoints =>
_ = endpoints.UseSoapEndpoint<IScriptLinkService>("/ScriptLinkService.asmx", new SoapEncoderOptions(), SoapSerializer.XmlSerializer);
// Optional Alternative
// _ = endpoints.UseSoapEndpoint<IScriptLinkService>("/ScriptLinkService.svc", new SoapEncoderOptions(), SoapSerializer.DataContractSerializer);


Update Launch Settings

This will help us launch the app and load the WSDL in the browser once running.

  1. Expand the Properties Folder and open the launchSettings.json file.
  2. In the https profile insert the following line before the applicationUrl: "launchUrl": "ScriptLinkService.asmx",.
// previous content
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "ScriptLinkService.asmx",
"applicationUrl": "https://localhost:7140;http://localhost:5106",
"environmentVariables": {
// following content

Run the application

  1. Run/debug the application with the https profile.

Congratulations! You should now see your WSDL showing in the browser and are ready to make the API calls.

If the WSDL was not automatically launched in your browser, you can get the URL from the launchSettings.json file. For example, https://localhost:7140/ScriptLinkService.asmx as seen in the same launchSettings file above.