WcfClient.Dynamic
6.0.1
See the version list below for details.
dotnet add package WcfClient.Dynamic --version 6.0.1
NuGet\Install-Package WcfClient.Dynamic -Version 6.0.1
<PackageReference Include="WcfClient.Dynamic" Version="6.0.1" />
paket add WcfClient.Dynamic --version 6.0.1
#r "nuget: WcfClient.Dynamic, 6.0.1"
// Install WcfClient.Dynamic as a Cake Addin #addin nuget:?package=WcfClient.Dynamic&version=6.0.1 // Install WcfClient.Dynamic as a Cake Tool #tool nuget:?package=WcfClient.Dynamic&version=6.0.1
WcfClient.Dynamic
This package simplifies the process of consuming web endpoints of SOAP style, allowing dynamic (re)configuration of endpoint address, binding type, and all related data within appsettings
. Incoming and outgoing messages, as well as other properties, can be configured using this package.
Installation
The package may be installed with the following commands:
- Using the
.NET CLI
:
dotnet add package WcfClient.Dynamic --latest
- Using
NPM
:
npm install WcfClient.Dynamic@latest
- Using
NuGet Package Manager Console
:
Install-Package WcfClient.Dynamic
Configuration
In the startup.cs or in the program.cs class, add the following line of code to configure a WCF client for consuming the desired web service:
services.AddWcfGenericClient<WebServiceInterface, Settings>(configurationSectionName)
where Settings
is a SoapSettings
class or any other class that derives from it.
The configuration section in the appsettings
file may take one of the following forms:
"ConfigurationSectionName": {
"OutgoingMessageHeaders": {
"Headers": [
{
"Key": "HeaderName",
"Value": "HeaderValue",
"Ns": "Namespace"
}
]
},
"OutgoingMessageProperties": [
{
"Key": "CookieName",
"Value": "CookieValue"
}
],
"SoapClient": {
// Binding section here ...
// ...
"EndpointConfiguration": 1
}
}
Note that OutgoingMessageHeaders
and OutgoingMessageProperties
sections are optional.
Allowed bindings
Each binding has these properties in common:
{
"EndpointAddress": "https://{service-address}.asmx",
"Name": "binding-name",
"NamespaceIdentifier": "ns",
"CloseTimeout": 60000,
"OpenTimeout": 60000,
"ReceiveTimeout": 60000,
"SendTimeout": 60000
}
The following bindings may be declared in the "Binding" section:
- BasicHttpsBinding:
"SoapHttpsBinding": {
// Common binding properties not included here for the sake of simplicity and readability
"AllowCookies": true,
"BypassProxyOnLocal": true,
"MaxBufferSize": null,
"MaxBufferPoolSize": null,
"MaxReceivedMessageSize": null,
"TransferMode": null,
"UseDefaultWebProxy": null,
"HostNameComparisonMode": null,
"BasicHttpsSecurityMode": 0,
"WSMessageEncoding": 1
}
For more information, inspect the SoapHttpsBinding
class.
- BasicHttpBinding;
- NetHttpBinding;
- NetHttpsBinding;
- NetNamedPipeBinding;
- NetTcpBinding;
- WSHttpBinding;
- Ws2007HttpBinding;
- WsFederationHttpBinding.
Usage
The WCF client may be injected into the specified service via:
IGenericWcfClient<WebServiceInterface> wcfClient
;Func<Settings, WcfClient<WebServiceInterface>> factoryMethod
.
If you choose the second option, it will be necessary to inject the following lines into the constructor's declaration of your service implementation:
Func<WcfClient<WebServiceInterface>, OperationContextScope> scopeSelector
;IOptionsSnapshot<Settings> settings
;
The consumption of the web service would look like this:
var result = await _wcfClient.CallAsync(x =>
{
return x.Service.GetInfoAsync(new GetInfoRequest());
}
or
using (var client = _factoryMethod(_settings.Value))
{
using (var scope = _scopeSelector(client))
{
// apply message's outgoing headers and properties here
// ...
return client.Service.GetInfoAsync(new GetInfoRequest());
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- Microsoft.Extensions.Configuration (>= 6.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 6.0.0)
- Microsoft.Extensions.Http (>= 6.0.0)
- SafeAgainst (>= 6.0.0)
- WcfClient.Settings (>= 6.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on WcfClient.Dynamic:
Package | Downloads |
---|---|
WcfClient.Resilient
Provides a resilient WCF client as a web service reverse proxy built on top of GenericWcfClient, featuring support for Polly's retry actions and the circuit breaker pattern. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.2 | 112 | 10/14/2024 |
8.0.1 | 113 | 9/14/2024 |
8.0.0 | 126 | 5/18/2024 |
8.0.0-beta | 106 | 5/8/2024 |
8.0.0-alpha | 84 | 5/1/2024 |
6.0.1 | 82 | 11/5/2024 |
6.0.0 | 127 | 6/6/2024 |
5.0.1 | 102 | 11/8/2024 |
5.0.0 | 103 | 6/17/2024 |
Prevented socket exhaustion