Click here to Skip to main content
15,917,481 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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:
C#
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:
C#
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:
C#
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();

Thank you everyone in advance.

What I have tried:

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.
Posted
Updated 6-Nov-23 1:14am
v2
Comments
[no name] 5-Nov-23 12:19pm    
https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2017/test/how-to-create-a-web-service-test?view=vs-2017
Member 13304618 6-Nov-23 9:36am    
This answer is completely irrelevant and unhelpful as I am trying to find a solution for the .NET Core, not for the .NET Framework

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900