WebRequestProxy 1.2.6
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package WebRequestProxy --version 1.2.6
NuGet\Install-Package WebRequestProxy -Version 1.2.6
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.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WebRequestProxy --version 1.2.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WebRequestProxy, 1.2.6"
#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.6
// Install WebRequestProxy as a Cake Tool
#tool nuget:?package=WebRequestProxy&version=1.2.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
测试用例:
服务代码:服务端代码可参考: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();
}
[WebMethod]
public string AddCars(List<MyCar> cars)
{
var _car = cars;
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);
//-----------------------------------------------------------------------------------------------------
//调用方法名
const string methodName = "AddCar";
//构建JSON对象或实体
var jsonStr = {"myCar":{"id":"44","name":"423","mycode2":"42","code1":2,"msg1":"42","wfList":[{"code":"1","msg":"成功1","Date":"2021-01-23T21:14:01.0831132+08:00","TemperatureC":"6","Summary":"Hot","myCar":{"id":"424","name":"4323","mycode2":"42","code1":2},"MyCar2List":[{"id":"1","name":"4323","mycode2":"42"}]}],"wf":{"code":"4","msg":"成功4","Date":"2021-01-25T21:14:01.0841135+08:00","TemperatureC":"10","Summary":"Hot4","myCar":{"id":"424","name":"4323","mycode2":"42","code1":2},"MyCar2List":[{"id":"4","name":"4323","mycode2":"42"}]}}};
//通过Soap调用,返回对象数据
var result = WebRequestProxy.WebServiceCaller.Query(url, methodName, jsonStr);
//--------------------------------------------------------------------------------
//调用方法名
const string methodName = "AddCar";
//构建JSON对象或实体
var jsonStr = {"cars":[{"myCar":{"id":"23","name":"423","mycode2":"42","code1":2,"msg1":"42","wfList":[{"code":"1","msg":"成功1","Date":"2021-01-23T21:14:01.0831132+08:00","TemperatureC":"6","Summary":"Hot","myCar":{"id":"424","name":"4323","mycode2":"42","code1":2},"MyCar2List":[{"id":"1","name":"4323","mycode2":"42"}]}],"wf":{"code":"4","msg":"成功4","Date":"2021-01-25T21:14:01.0841135+08:00","TemperatureC":"10","Summary":"Hot4","myCar":{"id":"424","name":"4323","mycode2":"42","code1":2},"MyCar2List":[{"id":"4","name":"4323","mycode2":"42"}]}}},{"myCar":{"id":"12","name":"423","mycode2":"42","code1":2,"msg1":"42","wfList":[{"code":"1","msg":"成功1","Date":"2021-01-23T21:14:01.0831132+08:00","TemperatureC":"6","Summary":"Hot","myCar":{"id":"424","name":"4323","mycode2":"42","code1":2},"MyCar2List":[{"id":"1","name":"4323","mycode2":"42"}]}],"wf":{"code":"4","msg":"成功4","Date":"2021-01-25T21:14:01.0841135+08:00","TemperatureC":"10","Summary":"Hot4","myCar":{"id":"424","name":"4323","mycode2":"42","code1":2},"MyCar2List":[{"id":"4","name":"4323","mycode2":"42"}]}}}]};
//通过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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.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.