WebRequestProxy 1.2.7

dotnet add package WebRequestProxy --version 1.2.7
NuGet\Install-Package WebRequestProxy -Version 1.2.7
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="WebRequestProxy" Version="1.2.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WebRequestProxy --version 1.2.7
#r "nuget: WebRequestProxy, 1.2.7"
#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 WebRequestProxy as a Cake Addin
#addin nuget:?package=WebRequestProxy&version=1.2.7

// Install WebRequestProxy as a Cake Tool
#tool nuget:?package=WebRequestProxy&version=1.2.7

一个通用的Web Api,Webservice,WCF调用类库

测试用例:

服务代码:服务端代码可参考:https://github.com/stoneson/WebServiceTest [WebMethod] public WeatherForecast getBySummarie(string summarie) { var rng = new Random(); var ls = Enumerable.Range(1, 5).Select(index ⇒ new WeatherForecast { code = index, msg = "成功" + index, Date = DateTime.Now.AddDays(index), TemperatureC = rng.Next(-20, 55), Summary = Summaries[rng.Next(Summaries.Length)] }) .ToList(); var fd = ls.FirstOrDefault(f ⇒ f.Summary == summarie); if (fd == null) fd = ls.FirstOrDefault(); return fd; }

     [WebMethod]
    public string AddCar(MyCar MyCar)
    {
        var _car = MyCar;

        return ResponseResultObj.Success(_car, "Success").ToJson();
    }
    

调用示例:

//构造soap请求信息
//服务地址
var url = "http://localhost:44351/WebService1.asmx"; WCF用:"http://localhost:44351/ServiceTest.svc";
//调用方法名
const string methodName = "getBySummarie";

//构建参数对象
var hab = new Dictionary<string, object>();
hab.Add("summarie", "test");

//通过Soap调用,返回对象数据
var result = WebRequestProxy.WebServiceCaller.Query(url, methodName, hab);

//或者:

//构建JSON对象或实体
var jsonStr = {  "Summarie": "test"};

//通过Soap调用,返回对象数据
var result = WebRequestProxy.WebServiceCaller.Query(url, methodName, jsonStr);
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 net452 is compatible.  net46 was computed.  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.

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.2.7 356 1/25/2021
1.2.6 291 1/25/2021

利用WebRequest/WebResponse进行WebService/WCF调用的类