![]() |
VOOZH | about |
dotnet add package WcfClient.Dynamic --version 8.0.3
NuGet\Install-Package WcfClient.Dynamic -Version 8.0.3
<PackageReference Include="WcfClient.Dynamic" Version="8.0.3" />
<PackageVersion Include="WcfClient.Dynamic" Version="8.0.3" />Directory.Packages.props
<PackageReference Include="WcfClient.Dynamic" />Project file
paket add WcfClient.Dynamic --version 8.0.3
#r "nuget: WcfClient.Dynamic, 8.0.3"
#:package WcfClient.Dynamic@8.0.3
#addin nuget:?package=WcfClient.Dynamic&version=8.0.3Install as a Cake Addin
#tool nuget:?package=WcfClient.Dynamic&version=8.0.3Install as a Cake Tool
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.
The package may be installed with the following commands:
.NET CLI:dotnet add package WcfClient.Dynamic --latest
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.
The following configuration shows allowed bindings for the WCF client:
{
"SoapSettings": {
"ServiceLifetime": "Transient",
"OutgoingMessageHeaders": {
"Headers": [
{
"Key": "HeaderName",
"Value": "HeaderValue",
"Ns": "Namespace"
}
]
},
"OutgoingMessageProperties": [
{
"Key": "CookieName",
"Value": "CookieValue"
}
],
"SoapClient": {
"SoapHttpBinding": {
"EndpointAddress": "https://example.com/service.svc",
"CloseTimeout": 30,
"Name": "MySoapHttpBinding",
"NamespaceIdentifier": "http://tempuri.org/",
"OpenTimeout": 30,
"ReceiveTimeout": 60,
"SendTimeout": 60,
"AllowCookies": false,
"BypassProxyOnLocal": true,
"MaxBufferSize": 65536,
"MaxBufferPoolSize": 524288,
"MaxReceivedMessageSize": 65536,
"TransferMode": "Buffered",
"ClientCredentialType": "Windows",
"ProxyCredentialType": "None",
"MessageCredentialType": "UserName",
"UseDefaultWebProxy": true,
"HostNameComparisonMode": "StrongWildcard",
"SecurityMode": "Transport",
"MessageEncoding": "Text"
},
"SoapHttpsBinding": {
"EndpointAddress": "https://secure.example.com/service.svc",
"CloseTimeout": 30,
"Name": "MySoapHttpsBinding",
"NamespaceIdentifier": "http://tempuri.org/",
"OpenTimeout": 30,
"ReceiveTimeout": 60,
"SendTimeout": 60,
"AllowCookies": false,
"BypassProxyOnLocal": true,
"MaxBufferSize": 65536,
"MaxBufferPoolSize": 524288,
"MaxReceivedMessageSize": 65536,
"TransferMode": "Buffered",
"ClientCredentialType": "Certificate",
"ProxyCredentialType": "None",
"MessageCredentialType": "UserName",
"UseDefaultWebProxy": true,
"HostNameComparisonMode": "StrongWildcard",
"BasicHttpsSecurityMode": "Transport",
"MessageEncoding": "Text"
},
"SoapNetHttpBinding": {
"EndpointAddress": "https://api.example.com/nethttp/service.svc",
"CloseTimeout": 30,
"Name": "MySoapNetHttpBinding",
"NamespaceIdentifier": "http://tempuri.org/",
"OpenTimeout": 30,
"ReceiveTimeout": 60,
"SendTimeout": 60,
"AllowCookies": false,
"BypassProxyOnLocal": true,
"MaxBufferSize": 65536,
"MaxBufferPoolSize": 524288,
"MaxReceivedMessageSize": 65536,
"TransferMode": "Buffered",
"ClientCredentialType": "Windows",
"ProxyCredentialType": "None",
"MessageCredentialType": "UserName",
"UseDefaultWebProxy": true,
"HostNameComparisonMode": "StrongWildcard",
"MessageEncoding": "Text",
"SecurityMode": "Transport",
"ReliableSessionEnabled": true
},
"SoapNetHttpsBinding": {
"EndpointAddress": "https://secure.example.com/service.svc",
"CloseTimeout": 30,
"Name": "MySoapHttpsBinding",
"NamespaceIdentifier": "http://tempuri.org/",
"OpenTimeout": 30,
"ReceiveTimeout": 60,
"SendTimeout": 60,
"AllowCookies": false,
"BypassProxyOnLocal": true,
"MaxBufferSize": 65536,
"MaxBufferPoolSize": 524288,
"MaxReceivedMessageSize": 65536,
"TransferMode": "Buffered",
"ClientCredentialType": "Certificate",
"ProxyCredentialType": "None",
"MessageCredentialType": "UserName",
"UseDefaultWebProxy": true,
"HostNameComparisonMode": "StrongWildcard",
"BasicHttpsSecurityMode": "Transport",
"MessageEncoding": "Text"
},
"SoapNetNamedPipeBinding": {
"EndpointAddress": "net.pipe://localhost/MyService",
"CloseTimeout": 30,
"Name": "MySoapNetNamedPipeBinding",
"NamespaceIdentifier": "http://tempuri.org/",
"OpenTimeout": 30,
"ReceiveTimeout": 60,
"SendTimeout": 60,
"SecurityMode": "Transport",
"ProtectionLevel": "EncryptAndSign",
"TransferMode": "Buffered",
"MaxBufferPoolSize": 524288,
"MaxBufferSize": 65536,
"MaxConnections": 10,
"MaxReceivedMessageSize": 65536
},
"SoapNetTcpBinding": {
"EndpointAddress": "net.tcp://localhost:8080/MyService",
"CloseTimeout": 30,
"Name": "MySoapNetTcpBinding",
"NamespaceIdentifier": "http://tempuri.org/",
"OpenTimeout": 30,
"ReceiveTimeout": 60,
"SendTimeout": 60,
"TransferMode": "Buffered",
"MaxBufferPoolSize": 524288,
"MaxBufferSize": 65536,
"MaxConnections": 10,
"MaxReceivedMessageSize": 65536,
"SecurityMode": "Transport",
"ReliableSessionEnabled": true,
"ClientCredentialType": "Windows",
"ProtectionLevel": "EncryptAndSign",
"MessageCredentialType": "UserName"
},
"SoapWsHttpBinding": {
"EndpointAddress": "https://example.com/wshttp/service.svc",
"CloseTimeout": 30,
"Name": "MySoapWsHttpBinding",
"NamespaceIdentifier": "http://tempuri.org/",
"OpenTimeout": 30,
"ReceiveTimeout": 60,
"SendTimeout": 60,
"SecurityMode": "TransportWithMessageCredential",
"ReliableSessionEnabled": true,
"BypassProxyOnLocal": true,
"TransactionFlow": false,
"MaxBufferPoolSize": 524288,
"MaxReceivedMessageSize": 65536,
"MessageEncoding": "Text",
"UseDefaultWebProxy": true,
"ClientCredentialType": "Windows",
"ProxyCredentialType": "None",
"MessageCredentialType": "UserName",
"EstablishSecurityContext": true,
"NegotiateServiceCredential": true,
"AllowCookies": false
},
"SoapWS2007HttpBinding": {
"EndpointAddress": "https://example.com/wshttp2007/service.svc",
"CloseTimeout": 30,
"Name": "MySoapWsHttpBinding",
"NamespaceIdentifier": "http://tempuri.org/",
"OpenTimeout": 30,
"ReceiveTimeout": 60,
"SendTimeout": 60,
"SecurityMode": "TransportWithMessageCredential",
"ReliableSessionEnabled": true,
"BypassProxyOnLocal": true,
"TransactionFlow": false,
"MaxBufferPoolSize": 524288,
"MaxReceivedMessageSize": 65536,
"MessageEncoding": "Text",
"UseDefaultWebProxy": true,
"ClientCredentialType": "Windows",
"ProxyCredentialType": "None",
"MessageCredentialType": "UserName",
"EstablishSecurityContext": true,
"NegotiateServiceCredential": true,
"AllowCookies": false
},
"SoapWSFederationHttpBinding": {
"EndpointAddress": "https://auth.example.com/wsfed/service.svc",
"CloseTimeout": 30,
"Name": "MySoapWSFederationHttpBinding",
"NamespaceIdentifier": "http://tempuri.org/",
"OpenTimeout": 30,
"ReceiveTimeout": 60,
"SendTimeout": 60,
"SecurityMode": "TransportWithMessageCredential",
"ReliableSessionEnabled": true,
"BypassProxyOnLocal": true,
"TransactionFlow": false,
"MaxBufferPoolSize": 524288,
"MaxReceivedMessageSize": 65536,
"MessageEncoding": "Text",
"UseDefaultWebProxy": true,
"ClientCredentialType": "Windows",
"ProxyCredentialType": "None",
"MessageCredentialType": "UserName",
"EstablishSecurityContext": true,
"NegotiateServiceCredential": true,
"AllowCookies": false,
"WsTrustTokenParameters": {
"IssuerAddress": "https://sts.example.com/issue",
"IssuerBinding": "WSHttpBinding",
"KeyType": "Bearer",
"TokenType": "urn:oasis:names:tc:SAML:2.0:assertion",
"Claims": [
"email",
"role",
"name"
]
}
},
"EndpointConfiguration": "SoapHttpBinding"
}
}
}
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 | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
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. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 8.0.3 | 232 | 10/26/2025 |
| 8.0.2 | 1,306 | 10/14/2024 |
| 8.0.1 | 248 | 9/14/2024 |
| 8.0.0 | 249 | 5/18/2024 |
| 8.0.0-beta | 204 | 5/8/2024 |
| 8.0.0-alpha | 188 | 5/1/2024 |
| 6.0.1 | 185 | 11/5/2024 |
| 6.0.0 | 256 | 6/6/2024 |
| 5.0.1 | 254 | 11/8/2024 |
| 5.0.0 | 232 | 6/17/2024 |
Added