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()
{
InitializeComponent();
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);
builder.Services.AddSoapCore();
builder.Services.TryAddSingleton<AuthorService>();
builder.Services.AddMvc();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
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.