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 中字段属性的更多相关文章

  1. WCF 、Web API 、 WCF REST 和 Web Service 的区别

    WCF .Web API . WCF REST 和 Web Service 的区别 The .Net framework has a number of technologies that allow ...

  2. 转 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 ...

  3. 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 ...

  4. 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 ...

  5. 项目中使用WCF替换asmx Web service总结

    以前项目解决方案中,用http协议的asmx Web service作服务器数据访问入口,在SoapHeader中写入用户名和加盐密码进行身份认证. http asmx服务是明文传输,传输过程中数据很 ...

  6. WCF、WebAPI、WCF REST、Web Service之间的区别

    在.net平台下,有大量的技术让你创建一个HTTP服务,像Web Service,WCF,现在又出了Web API.在.net平台下,你有很多的选择来构建一个HTTP Services.我分享一下我对 ...

  7. WCF实现RESTFul Web Service

    共同学习了前面一些概念,终于开始正题了哈.RESTful的Web Service调用直观,返回的内容容易解析.这里先会描述一个简单的场景--Web Service提供一个方法来搜索个人信息,传入人名, ...

  8. 在基于WCF开发的Web Service导出WSDL定义问题及自定义wsdl:port 名称

             在契约优先的Web服务开发过程中,往往是先拿到WSDL服务定义,各家开发各自的服务实现或客户端,然后互相调用.          尽管Web Service的标准已经发布很多年,但各 ...

  9. WCF、Web API、WCF REST、Web Service之区别

    http://www.dotnet-tricks.com/Tutorial/webapi/JI2X050413-Difference-between-WCF-and-Web-API-and-WCF-R ...

随机推荐

  1. DL_1_week2_神经网络基础

    二分类问题 在二分分类问题中,目标是训练出一个分类器,这里以图片特征向量x作为输入,预测输出的结果标签y是1还是0,也就是预测图片中是否有猫.          计算机保存一张图片(彩色),要保存三个 ...

  2. json、txt、xlsx

    json:   json异于pickle,无乱码,各语言都支持,但Python各对象只直接接收int,str,(),[],{}.读入txt时只接受str,int变为str(int),()[]{}被js ...

  3. MFC 多窗口通信时,使用RadioButton和Button时冲突问题

    最近项目需要我们实现在两个窗口间进行通信,其中有个小功能如图所示: 当我点击GDIProgram中的Button1时,会更新Dialog的Radio1和Radio2的状态. Dialog中的Radio ...

  4. 附加题2 :git 简单练习

    目的: 练习git 基本操作 理解版本管理 Task 1:在码云上新建一个项目,项目命名 『Helloworld』 ,设置为公开访问. step 0: 在你计算机安装git.参照互联网教程<gi ...

  5. [转]kaldi上的深度神经网络

    转:http://blog.csdn.net/wbgxx333/article/details/41019453 深度神经网络已经是语音识别领域最热的话题了.从2010年开始,许多关于深度神经网络的文 ...

  6. ES6教程-字符串,函数的参数,了解函数的arguments对象,js面向对象,设计模式-单例模式,解构赋值

    前言 主要讲解了ES6对字符串的拓展,包括includes,startsWith和endsWith,另外增加了字符串模板. Start includes()是否包含 startsWith()以什么开头 ...

  7. sql 语句的limit的用法

    SELECT * FROM table  LIMIT [offset,] rows | rows OFFSET offset   mysql> SELECT * FROM table LIMIT ...

  8. 跨浏览器的javascript事件的封装

    一,跨浏览器的事件处理程序 1,DOM0级处理事件 将一个函数赋值给一个事件处理程序属性. 事件流:冒泡阶段. 使用: 为元素增加事件: var btn = document.getElementBy ...

  9. PCIE 2.0协议概念基本科普

    PCIE的概念:是电脑总线PCI的一种,它沿用现有的PCI编程概念及通信标准,但建基于更快的串行通信系统. 英特尔是该接口的主要支持者.PCIe仅应用于内部互连.由于PCIe是基于现有的PCI系统,只 ...

  10. 关于文件命名,你必须要知道的(浏览器报错:net::ERR_BLOCKED_BY_CLIENT)

    坑爹的,今天在写完页面,用各个浏览器测试的时候,火狐.谷歌都是正常的,QQ浏览器出幺蛾子了,在使用兼容模式的时候页面正常,使用急速模式的时候部分页面正常,点击跳转到其他页面的时候就出错了,打开控制台一 ...