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 ...
随机推荐
- [solution] JZOJ 5459. 密室
[solution] JZOJ 5459. 密室 Description 小X 正困在一个密室里,他希望尽快逃出密室. 密室中有$N$ 个房间,初始时,小X 在1 号房间,而出口在N 号房间. 密室的 ...
- Http协议和Tomcat服务器
Http协议和Tomcat服务器 什么是Http协议 HTTP,超文本传输协议(HyperText Transfer Protocol)是互联网上应用最为广泛的一种网络协议. Http协议的组成 Ht ...
- ubuntu 14.04下搭建esp32开发环境
esp32是乐鑫出品的一款集成了wifi和蓝牙的集成模块,板上自带两个哈佛结构的Xtensa LX6 CPU双核处理器,本文主要讲解如何在linux下搭建其编译开发环境. 首先ctrl+alt+t打开 ...
- Runtime之实例总结
通过前面几篇对Runtime的讲解,本篇汇总一下Runtime实际中常用的一些场景. 1.获取类的基本信息 获取类名: const char *className = class_getName(cl ...
- 机器学习之KNN算法
1 KNN算法 1.1 KNN算法简介 KNN(K-Nearest Neighbor)工作原理:存在一个样本数据集合,也称为训练样本集,并且样本集中每个数据都存在标签,即我们知道样本集中每一数据与所属 ...
- c# 遍历所有安装程序 获取所有已经安装的程序
/// <summary> /// 获取所有已经安装的程序 /// </summary> /// <param name="reg"></ ...
- struts2框架学习笔记4:获取参数
第一种参数获取方式: 编写一个前端页面,提交表单,做示例: <form action="${pageContext.request.contextPath}/Demo1Action&q ...
- [Swift]键盘遮挡控件
键盘遮挡控件: super.viewDidLoad(){ // Do any additional setup after loading the view, typically from a nib ...
- JAVA基础语法——标识符、修饰符、关键字(个人整理总结)
JAVA基础语法——标识符.修饰符.关键字 一 . 标识符 1.1 什么是标识符 就是程序员在定义java程序时,自定义的一些名字,例如helloworld 程序里关键字class 后跟的Dem ...
- 跨浏览器的javascript事件的封装
一,跨浏览器的事件处理程序 1,DOM0级处理事件 将一个函数赋值给一个事件处理程序属性. 事件流:冒泡阶段. 使用: 为元素增加事件: var btn = document.getElementBy ...