SoapCore service always returns WSDL

115 Views Asked by At

I have a simple SoapCore service with some methods specified. When I load the ASMX page it shows the WSDL, but instead I would like to have a UI being shown from where I could call the web service methods

Here is the part of my Service contract

namespace QBCoreSOAPService
{
    [ServiceContract]
    public interface IAuthorService
    {
        [OperationContract]
        void MySoapMethod(XElement xml);

        [OperationContract]
        string getInteractiveURL(string wcTicket, string sessionID);

        [OperationContract]
        string interactiveRejected(string wcTicket, string reason);

Here is a part of my service

public class AuthorService : IAuthorService
{
    System.Diagnostics.EventLog evLog = new System.Diagnostics.EventLog();
    public int count = 0;
    public AuthorService() 
    {
        //CODEGEN: This call is required by the ASP.NET 
        //Web Services Designer
        InitializeComponent();
        // Initializing EventLog for logging
        initEvLog();
    }
    private void InitializeComponent()
    {
    }
    public void MySoapMethod(XElement xml)
    {
        Trace.WriteLine(xml.ToString());
    }
    public string getInteractiveURL(string wcTicket, string sessionID)
    {
        return "";
    }

Here is the Program.cs file

using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection.Extensions;
using QBCoreSOAPService;
using SoapCore;
using System.ServiceModel;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddSoapCore();
builder.Services.TryAddSingleton<AuthorService>();
builder.Services.AddMvc();
var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints => {
    endpoints.UseSoapEndpoint<IAuthorService>("/WCWebService.asmx", new SoapEncoderOptions(), SoapSerializer.DataContractSerializer);
});

app.MapRazorPages();

app.Run();

When I call/load the WCWebService.asmx, the wsdl shows up. But instead I would like to have actual GUI to show from which I could invoke the web service methods

Thank you everyone in advane

0

There are 0 best solutions below