This tutorial explains how to create a simple web service using HXF.net and how to consume it from a Windows Forms application client. You can use the same steps in this tutorial to consume the same service from other clients such as JavaScript, Android and iOS.

Creating The Solution

Start by creating a new project using your version of Visual Studio (I am using Visual Studio 2013 in this tutorial). Select the “ASP.NET Empty Web Application” template. Give a name to the project and the solution. The first step is shown below.

create_project

 

Creating The Interface and Class

Using HXF you can expose any simple C# or VB interface as a web service without the need to implement any custom interface or apply any custom attributes. It is even possible to expose any interface you already have as a web service following the same step.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HXF.Service
{
    public interface ITestService
    {
        string Greet(string name);
        int Sum(int x, int y);
    }
}

Last edited Aug 21, 2015 at 12:36 AM by kumaitm, version 1