WebRequestProxy 1.2.7
dotnet add package WebRequestProxy --version 1.2.7
NuGet\Install-Package WebRequestProxy -Version 1.2.7
<PackageReference Include="WebRequestProxy" Version="1.2.7" />
paket add WebRequestProxy --version 1.2.7
#r "nuget: WebRequestProxy, 1.2.7"
// 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 | Versions 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. |
-
.NETFramework 4.5.2
- HCenter.CommonUtils (>= 2.0.6)
- Newtonsoft.Json (>= 12.0.3)
- RestSharp (>= 106.11.7)
-
.NETStandard 2.0
- HCenter.CommonUtils (>= 2.0.6)
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 12.0.3)
- RestSharp (>= 106.11.7)
- System.Drawing.Common (>= 4.7.0)
- System.Reflection (>= 4.3.0)
- System.Reflection.Emit (>= 4.7.0)
- System.Runtime (>= 4.3.1)
- System.Runtime.Caching (>= 4.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
利用WebRequest/WebResponse进行WebService/WCF调用的类