DesteSoft.SoapClient 1.0.0

dotnet add package DesteSoft.SoapClient --version 1.0.0                
NuGet\Install-Package DesteSoft.SoapClient -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DesteSoft.SoapClient" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DesteSoft.SoapClient --version 1.0.0                
#r "nuget: DesteSoft.SoapClient, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DesteSoft.SoapClient as a Cake Addin
#addin nuget:?package=DesteSoft.SoapClient&version=1.0.0

// Install DesteSoft.SoapClient as a Cake Tool
#tool nuget:?package=DesteSoft.SoapClient&version=1.0.0                

SOAP Client for .NET

Project website

https://www.destesoft.com/soap-client/

Making SOAP requests easy!

The SOAP messaging protocol was extensively used in the past. We have new (and better) options today, like REST. However, many services we may require will still use the SOAP protocol.

SOAP Client for .NET allows us to make requests to SOAP services in a much simpler and cleaner way than using the old Web Service References from early versions of Visual Studio.

SOAP Client is configured at runtime, executes the method we ask at the moment and allows us to map the result directly to a native type or custom class, depending on the response we are expecting.

Installation

You can install the package from the Visual Studio Package Management window or using the Install-Package command:

Install-Package DesteSoft.SoapClient

How to use it

SOAP Client consists in only two steps: creating the client instance and making the request.

// Create instance of client
SoapClient client = new SoapClient("[SOAP service URL]", "[SOAP service namespace]");

// Make a void request
client.Post("[SOAP action]", [optional parameters]);

// Make a request and map result to a variable
string result = client.Post<string>("[SOAP action]", [parameters]);
SOAP service URL

The URL to the service we'll make requests to. If it's a ASP.NET Web Service, it should be the path to the ASMX file.

SOAP service namespace

The namespace can be found in the SOAP service WSDL as the targetNamespace attribute of the root node.

SOAP action

The specific web method we are requesting.

parameters (optional)

The parameters required by the SOAP action. They can be found in the service's WSDL, in the corresponding element node inside types.

There are different ways to make the request, all of them use the same parameters.

// Sync request returning no value
client.Post("SOAP action");

// Async request returning no value
await client.PostAsync("SOAP action");

// Sync request returning a value
int value = client.Post<int>("SOAP action");

// Async request returning a value
CustomClass result = await client.PostAsync<CustomClass>("SOAP action");

Mapping to custom classes

You may need to refer to the SOAP service's WSDL to check the type returned from a SOAP action.

The type sent to the generic method, Post<T> or PostAsync<T>, should match the SOAP action response type. If not matched, the default value will be set instead.

<definitions ...>
  <types>
    <schema ...>
      ...
      <complexType name="Item">
        <sequence>
          <element minOccurs="1" maxOccurs="1" name="Id" type="int" />
          <element minOccurs="1" maxOccurs="1" name="Name" type="string" />
          <element minOccurs="1" maxOccurs="1" name="CreatedDate" type="dateTime" />
        </sequence>
      </complexType>
      <element name="SoapActionResponse">
        <complexType>
          <sequence>
            <element minOccurs="0" maxOccurs="1" name="SoapActionResult" type="Item" />
          </sequence>
        </complexType>
      </element>
      ...
    </schema>
  </types>
  ...
</definitions>

In this example, the mapping class should look like this:

public class ResponseItem
{
  public int Id { get; set; }
  public string Name { get; set; }
  public DateTime Id { get; set; }
}

Not all of the properties need to match in the class. Unmatched values will get a default value.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 1,992 1/14/2021

Version 1.0.0