SoapRequestHelper 0.0.2

dotnet add package SoapRequestHelper --version 0.0.2
                    
NuGet\Install-Package SoapRequestHelper -Version 0.0.2
                    
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="SoapRequestHelper" Version="0.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SoapRequestHelper" Version="0.0.2" />
                    
Directory.Packages.props
<PackageReference Include="SoapRequestHelper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SoapRequestHelper --version 0.0.2
                    
#r "nuget: SoapRequestHelper, 0.0.2"
                    
#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.
#:package SoapRequestHelper@0.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SoapRequestHelper&version=0.0.2
                    
Install as a Cake Addin
#tool nuget:?package=SoapRequestHelper&version=0.0.2
                    
Install as a Cake Tool

在DotNet中使用HttpClient调用WebService服务

概述

构建Soap请求报文调用WebService接口服务,支持多端点配置,支持请求队列和并发配置

使用方式

配置服务

builder.Services.AddSoapServiceHelper(m =>
{
    m.AddSoapService("Service1"), config =>
    {
        config.Url = "Service1 WebServiceUrl";
        config.ConcurrencyLimit = maxConcurrent;
        config.QueueCapacity = maxQueueLimit;
        config.RequestNamespace = "RequestNamespace";
        config.ResponseNamespace = "ResponseNamespace";
    }).AddSoapService("Service2"), config =>
    {
        config.Url = "Service2 WebServiceUrl";
        config.ConcurrencyLimit = maxConcurrent;
        config.QueueCapacity = maxQueueLimit;
        config.RequestNamespace = "RequestNamespace";
        config.ResponseNamespace = "ResponseNamespace";
    }).SetDefault("Service1");
});

获取ISoapService

先获取ISoapServiceFactory
public class TestClass(ISoapServiceFactory soapFactory)
{

}
通过ISoapServiceFactory获取ISoapService
ISoapService service = soapFactory.GetSoapService("Service1");
使用ISoapService发送请求
SoapResponse response = await service.SendAsync("MethodName", new()
{
    ["Param1"] = value1,
    ["Param2"] = value2,
    ["Param3"] = value3
});
处理结果
属性/方法 说明 备注
Success 调用是否成功
Exception 异常对象
RawContent 响应的完整报文
RawValue 响应的Body内容
RequestContent 请求的原始报文
ReadReturnValue 返回接口签名中的返回值 具有泛型和非泛型版本,泛型可以尝试转化成对应的数据类型,非泛型返回dynamic
ReadReturnValueAsXml 返回接口签名中的返回值 返回值类型是XElement?
ReadReturnValueAsDataTable 如果返回值是DataTable,尝试转为DataTable
ReadParameterReturnValue out参数或者ref参数的返回值 具有泛型和非泛型版本,泛型可以尝试转化成对应的数据类型,非泛型返回dynamic
ReadParameterReturnValueAsXml out参数或者ref参数的返回值 返回值类型是XElement?
ReadParameterReturnValueAsDataTable out参数或者ref参数的返回值 如果返回值是DataTable,尝试转为DataTable
GetValue 根据XPath返回节点内容 需要加上r命名空间
GetNode 根据XPath返回节点 需要加上r命名空间
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.0.2 112 7/31/2025
0.0.1 263 7/30/2025