WCF Service 转换为Web Service 中字段属性
1.新建WCF服务,服务中包含对象
2.部署WCF服务,并将其转换为应用程序
3.通过添加服务引用,使用WCF服务
4.调用对应的对象时需要对应的值设置为True。
参考:https://cloud.tencent.com/developer/ask/73513
对象结构:
public class QueryClass
{
public DateTime STime;//开始时间
public DateTime ETime;//结束时间
public string SiteCode;//工厂
public string Department;//部门
public string AreaNo;//区域
public string PrdLine;//线号
public string Type;//点检类型
public string Shift;//班次
public string EquipmentNo;//设备编号
public string DailyCheckTaskID;//点检任务编号
}
添加引用后的代理代码
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.datacontract.org/2004/07/EASAPPSrv")]
public partial class QueryClass {
private string areaNoField;
private string dailyCheckTaskIDField;
private string departmentField;
private System.DateTime eTimeField;
private bool eTimeFieldSpecified;
private string equipmentNoField;
private string prdLineField;
private System.DateTime sTimeField;
private bool sTimeFieldSpecified;
private string shiftField;
private string siteCodeField;
private string typeField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string AreaNo {
get {
return this.areaNoField;
}
set {
this.areaNoField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string DailyCheckTaskID {
get {
return this.dailyCheckTaskIDField;
}
set {
this.dailyCheckTaskIDField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string Department {
get {
return this.departmentField;
}
set {
this.departmentField = value;
}
}
/// <remarks/>
public System.DateTime ETime {
get {
return this.eTimeField;
}
set {
this.eTimeField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool ETimeSpecified {
get {
return this.eTimeFieldSpecified;
}
set {
this.eTimeFieldSpecified = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string EquipmentNo {
get {
return this.equipmentNoField;
}
set {
this.equipmentNoField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string PrdLine {
get {
return this.prdLineField;
}
set {
this.prdLineField = value;
}
}
/// <remarks/>
public System.DateTime STime {
get {
return this.sTimeField;
}
set {
this.sTimeField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool STimeSpecified {
get {
return this.sTimeFieldSpecified;
}
set {
this.sTimeFieldSpecified = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string Shift {
get {
return this.shiftField;
}
set {
this.shiftField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string SiteCode {
get {
return this.siteCodeField;
}
set {
this.siteCodeField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string Type {
get {
return this.typeField;
}
set {
this.typeField = value;
}
}
}
调用引用的WCF服务
[WebMethod]
public string HelloWorld()
{
APPTEST.QueryClass qc = new APPTEST.QueryClass();
qc.EquipmentNo = "MD010205MX25";
qc.Type = "Equipment";
qc.STime = DateTime.Now.AddDays(-30);
qc.ETime = DateTime.Now;
qc.STimeSpecified = true;
qc.ETimeSpecified = true;
APPTEST.Srv_EASAPP client = new APPTEST.Srv_EASAPP();
string s = client.GetDailyTask(qc);
return "Hello World";
}
WCF Service 转换为Web Service 中字段属性的更多相关文章
- WCF 、Web API 、 WCF REST 和 Web Service 的区别
WCF .Web API . WCF REST 和 Web Service 的区别 The .Net framework has a number of technologies that allow ...
- 转 Difference between WCF and Web API and WCF REST and Web Service
http://www.dotnet-tricks.com/Tutorial/webapi/JI2X050413-Difference-between-WCF-and-Web-API-and-WCF-R ...
- WCF、Web API、WCF REST、Web Service
WCF.Web API.WCF REST.Web Service 区别 Web Service It is based on SOAP and return data in XML form. It ...
- WCF、Web API、WCF REST、Web Service的区别
Difference between WCF and Web API and WCF REST and Web Service The .Net framework has a number of ...
- 项目中使用WCF替换asmx Web service总结
以前项目解决方案中,用http协议的asmx Web service作服务器数据访问入口,在SoapHeader中写入用户名和加盐密码进行身份认证. http asmx服务是明文传输,传输过程中数据很 ...
- WCF、WebAPI、WCF REST、Web Service之间的区别
在.net平台下,有大量的技术让你创建一个HTTP服务,像Web Service,WCF,现在又出了Web API.在.net平台下,你有很多的选择来构建一个HTTP Services.我分享一下我对 ...
- WCF实现RESTFul Web Service
共同学习了前面一些概念,终于开始正题了哈.RESTful的Web Service调用直观,返回的内容容易解析.这里先会描述一个简单的场景--Web Service提供一个方法来搜索个人信息,传入人名, ...
- 在基于WCF开发的Web Service导出WSDL定义问题及自定义wsdl:port 名称
在契约优先的Web服务开发过程中,往往是先拿到WSDL服务定义,各家开发各自的服务实现或客户端,然后互相调用. 尽管Web Service的标准已经发布很多年,但各 ...
- WCF、Web API、WCF REST、Web Service之区别
http://www.dotnet-tricks.com/Tutorial/webapi/JI2X050413-Difference-between-WCF-and-Web-API-and-WCF-R ...
随机推荐
- PostgreSQL与PostGIS的关系
PostgreSQL相当于PostGIS的祖先,PostGIS是在PostgreSQL的基础上发展起来的,从它们的名字上也能看出些许端倪.PostgreSQL是一个开源数据库,而PostGIS在此基础 ...
- 获取Lambda表达式内表达式的值
随着Linq的盛行,对于Linq和Lmabda表达式的使用也越来越多,Lambda表达式在.net framework 3.5中提出来,Lambda表达式是一个匿名方法,通常在LINQ中被用来创建委托 ...
- mac中启动jmeter方法
1.mac中安装了jdk后,不需要去配置环境变量 2.现在jmeter包,解压缩后.打开terminal 3.在terminal中输入命令:sh jmeter.sh 打开Terminnal的方法: T ...
- Autofac与AOP功能例子
using Autofac.Extras.DynamicProxy; using System; using System.Collections.Generic; using System.Linq ...
- 压测工具之JMeter之环境配置及运行
一.下载JMeter 地址:http://jmeter.apache.org/download_jmeter.cgi 系统:win7 x64 在 Binaries 目录下选择一个合适自己系统的版本,不 ...
- 2月第3周业务风控关注|上海网信办复测23个被约谈APP 涉及1号店、小红书等
易盾业务风控周报每周呈报值得关注的安全技术和事件,包括但不限于内容安全.移动安全.业务安全和网络安全,帮助企业提高警惕,规避这些似小实大.影响业务健康发展的安全风险. 1.上海网信办复测23个被约谈A ...
- Maven(个人整理)(一,未完待续)
Maven 1. 什么是Maven? 乍一看,Maven看起来很多东西,但简而言之,Maven试图将 ...
- Data - References
01 - 数据分析与数据挖掘的知识列表 图解 知识列表 |关注方面|初级数据分析师|高级数据分析师|数据挖掘工程师| |--------|--------|--------|--------| | 数 ...
- C# 本进程执行完毕后再执行下一线程
最近做了一套MES集成系统,由上料到成品使自动化运行,其中生产过程是逐步的,但是每一个动作都需要独立的线程进行数据监听,那么就需要实现线程等待. 代码: using System; using Sys ...
- 持续集成工具-Jenkins 使用介绍
Jenkins 是一个可扩展的持续集成引擎,可以为我们提供代码自动编译.打包和发布工作,减少部署成本. 一.安装与启动 Jenkins 提供了多种便捷的安装方式,比较推荐使用执行 war 包的方式. ...