Simple client for SOAP requests.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 65bcc2a Dec 15, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
SoapClient Version 1.1 Dec 14, 2017
SoapClientTests Version 1.0.0 Dec 13, 2017
.gitignore Version 1.0.0 Dec 13, 2017
README.md Fixed definition of SOAPAction. Dec 14, 2017
SoapClient.sln Version 1.0.0 Dec 13, 2017

README.md

SOAPClientService

Simple client for SOAP requests.

The SOAPClient class allows easy remote calls to web services through SOAP protocol.

Methods

Post(string method, object data = null)

Makes a POST request to the defined method in the configured server.

Post<T>(string method, object data = null)

Makes a POST request to the defined method in the configured server and returns the result as an object of the defined type. Returns an object of type T with the result retrieved from the SOAP response.

PostAsync(string method, object data = null)

Makes an asynchronous POST request to the defined method in the configured server.

PostAsync<T>(string method, object data = null)

Makes an asynchronous POST request to the defined method in the configured server and returns the result as an object of the defined type. Returns an object of type T with the result retrieved from the SOAP response.

Parameters

T Type of the response object returned.

method Name of the web method inside the web service request.

data Parameters to send in the request message (optional).

Requirements

This library requires System.Net.Http 4.0 or above, which can be found in the .NET assemblies or downloaded through Nuget.

Example

using (SOAPClient client = new SOAPClient(
    "https://www.w3schools.com/xml/tempconvert.asmx",
    "https://www.w3schools.com/xml/"))
{
    string fahrenheit = client.PostAsync<string>(
        "CelsiusToFahrenheit",
        new
        {
            Celsius = celsius
        }).Result;
    return fahrenheit;
}