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. No趴笨小分队

    这星期完成了小组的取名这一项重大的活动. 正所谓“名字是一个好开头”,取这个名义有以下的意义: 希望之后的学习以及工作能一帆风顺: 祝福各位小组成员之后的路能顺顺利利: 希望能在组员磨合的过程中可以愉 ...

  2. 通过linux核映射驱动访问GPIO

    1. HPS GPIO原理 1.功能方块图 linux内核是通过Linux内核memory-mapped device驱动访问GPIO控制器的寄存器而控制HPS端用户的LED和KEY的.memory- ...

  3. 基于 Keras 的 LSTM 时间序列分析——以苹果股价预测为例

    简介 时间序列简单的说就是各时间点上形成的数值序列,时间序列分析就是通过观察历史数据预测未来的值.预测未来股价走势是一个再好不过的例子了.在本文中,我们将看到如何在递归神经网络的帮助下执行时间序列分析 ...

  4. 第二十七节:Java基础面向对象-静态,单例模式,继承详情知识点

    前言 Java基础面向对象-静态,单例模式,继承详情知识点.静态-static关键字,static变量,静态代码块,代码块(不加静态),对象创建过程,单例模式,继承. 静态-static关键字 // ...

  5. 3-1 vue生命周期

    Vue实例生命周期函数 ================================================================== ③-④当beforeMount这个函数执行 ...

  6. [视频]K8软件破解脱壳入门教程

    [视频]K8软件破解脱壳入门教程 链接:https://pan.baidu.com/s/1aV9485MmtRedU6pzyr--Vw 提取码:vbak C:\Users\K8team\Desktop ...

  7. mysql 开发进阶篇系列 36 工具篇mysqlshow(数据库对象查看工具)

    一.概述 mysqlshow客户端查找工具,能很快地查找存在哪些数据库,数据库中的表,表中的列或索引,和mysql客户端工具很类似,不过有些特性是mysql客户端工具所不具备的. mysqlshow的 ...

  8. mac下nginx搭建

    首先使用brew安装nginx brew install nginx 安装完毕后,如果我们要使用nginx监听本地的80端口,需要改掉mac自带的apache占用的80端口 sudo vim /etc ...

  9. OpenGL10-骨骼动画原理篇(1)

    视频教程请关注 http://edu.csdn.net/lecturer/lecturer_detail?lecturer_id=440 本例程展示如何建立骨骼动画,有些人叫蒙皮动画 定义如下: 当前 ...

  10. kafka集群管理

    1.启动kafka集群 kafka 没有提供同时启动集群中所有节点的执行脚本,这里自定义一个脚本 名称为 kafka-cluster-start.sh 2.关闭节点 kafka自带关闭脚本 kafka ...