SOAP Service Calls for .NET - 1.0

Extension ID

com.castsoftware.dotnet.soap

What’s new?

See SOAP Service Calls for .NET - 1.0 - Release Notes for more information.

Description

This extension provides support for SOAP services in .NET applications, specifically focusing on ASMX (ASP .NET) and SoapCore implementations. This extension works in complement with dotnet, dotnetweb, and wcf extensions, each addressing specific libraries and patterns of SOAP in the .NET ecosystem.

In what situation should you install this extension?

If your C# application utilizes SOAP based web services like ASMX or SoapCore and you want to view objects with their corresponding links then you should install this extension.

Technology support

SOAP is built-in features of the .NET Framework:

Language Version Supported Comment
.NET Framework 1.1 to 4.8 Supports ASMX Web Services (ASP.NET)

SoapCore

SoapCore version .NET .NET Core .NET Standard Supported
1.1.0.21 - 1.1.0.51 5.0 - 6.0 3.1 2.0 - 2.1
1.1.0.10 - 1.1.0.20 5.0 2.1 - 3.1 2.0
1.0.0 - 1.1.0.9 - 2.1 - 3.1 2.0

Compatibility 

This extension is compatible with:

Release Operating System Supported
v3/8.4.x Microsoft Windows / Linux
v2/8.3.x Microsoft Windows

Dependencies

The com.castsoftware.dotnet.soap extension is dependent on following other extensions:

Download and installation instructions

The extension will not be automatically downloaded and installed. If you need to use it, you should manually install the extension using the Extensions interface:

What results can you expect?

Objects

Icon Description Comment
DotNet SOAP Operation an object is created when we encounter [WebMethod] attribute (or) an object is created for each method of specified class in SoapCore endpoint
DotNet SOAP Operation Call an object is created for each SOAP operation call and Web service method is resolved
DotNet SOAP Unknown Operation Call an object is created for each SOAP operation call and Web service method is not resolved
Link Type Source and Destination Link Supported APIs
callLink Link between the caller C# method and the DotNet SOAP Operation Call object
  • System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke
  • System.Web.Services.Protocols.SoapHttpClientProtocol.InvokeAsync
  • System.Web.Services.Protocols.SoapHttpClientProtocol.BeginInvoke
callLink Link between the DotNet SOAP Operation object and C# method
  • System.Web.Services.WebMethodAttribute
  • SoapCore.SoapEndpointExtensions.UseSoapEndpoint

Code Examples

Server Side

SOAP Operation

// Methods with [WebMethod] are Web services
[WebMethod]
public bool InsertAssessment(Assessment a)
{
    return DAL.InsertAssessment(a);
}//close InsertAssessment

Client Side

SOAP Operation Call

wsdl file

<wsdl:definitions xmlns:tns="http://tempuri.org/"  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:portType name="WebService1Soap">
    <wsdl:operation name="InsertAssessment">
      <wsdl:input message="tns:InsertAssessmentSoapIn" />
      <wsdl:output message="tns:InsertAssessmentSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
</wsdl:definitions>
  • wsdl file contains “portType”
public bool InsertAssessment(Assessment a) {
    object[] results = this.Invoke("InsertAssessment", new object[] {
                a});
    return ((bool)(results[0]));
}

SOAP Unknown Operation Call

public System.Data.DataTable GetTable(string table, string col) {
    String method = getMethodName();
    object[] results = this.Invoke(method, new object[] {
                table,
                col});
    return ((System.Data.DataTable)(results[0]));
}

SoapCore Server Side

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

namespace SoapServer
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton<ICalculatorService, CalculatorService>();
        }

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                // All Methods inside CalculatorService class are Web services
                endpoints.UseSoapEndpoint<CalculatorService>("/CalculatorService.asmx", new SoapEncoderOptions(), SoapSerializer.DataContractSerializer);
            });
        }
    }
}
namespace SoapServer
{
    public class CalculatorService : ICalculatorService
    {
        public int Add(int a, int b) => a + b;

        public int Subtract(int a, int b) => a - b;

        public int Multiply(int a, int b) => a * b;

        public int Divide(int a, int b) => b != 0 ? a / b : throw new System.DivideByZeroException();
    }
}

Limitations 

  • For VB.NET, only server side support is provided.
  • This extension will not currently delete all duplicated SOAP objects generated by the com.castsoftware.dotnet extension for the following reasons:
    • To make sure there are no regressions in connectivity.
    • To materialize objects originiating from client-side (VB.NET) APIs that are not yet supported.

The table below provides information about how duplicate objects generated by the com.castsoftware.dotnet are handeled:

  • The Before column refers to results from com.castsoftware.dotnet without the addition of the com.castsoftware.dotnet.soap extension.
  • The After column refers to results produced with the addition of the com.castsoftware.dotnet.soap extension.

This table is applicable for com.castsoftware.dotnet version 1.0.0 to latest:

Example Before After Explanation
C# -> C# For CSharp projects full support is provided So both server and client from .Net Analyzer are deleted and Soap Extension objects are created
C# -> VB.NET For VB.NET server side support is provided So both server and client from .Net Analyzer are deleted and Soap Extension objects are created
VB.NET -> C# client side support is not provided for VB.NET, .NET SOAP Operation object object is not deleted to maintain connectivity
VB.NET -> VB.NET Only server side support is provided for VB.NET, .NET SOAP Operation object object is not deleted to maintain connectivity
VB.NET (server-side) server side support is provided for VB.NET so .NET SOAP Operation object gets deleted and DotNet SOAP Operation object is created
VB.NET (client-side) client side support is not provided for VB.NET so .NET SOAP ressource service object is not deleted
C# (client-side) For CSharp projects full support is provided So .NET SOAP ressource service object is deleted and DotNet Soap OperationCall object is created
C# (server-side) For CSharp projects full support is provided So .NET SOAP Operation object is deleted and DotNet Soap Operation object is created