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. _ZNote_Qt_Tips_添加动态链接库

    之前添加都是 手写添加,今天陈老师提示可以在 .pro 文件内空白处,右键弹出添加

  2. Python自动化开发 - Python操作Memcached、Redis、RabbitMQ

    Memcached Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载. 它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态.数据库驱动网站的速 ...

  3. bash编程-正则表达式

    正则表达式与通配符有部分相似之处,但正则表达式更复杂也更强大. 通配符用于(完全)匹配文件名,支持通配符的命令有:ls.find.cp等: 正则表达式用于在文件中(包含)匹配字符串,支持的命令有:gr ...

  4. SDWebImage之SDWebImageManager

    SDWebImageManager是SDWebImage的核心类.它拥有一个SDWebImageCache和一个SDWebImageDownloader属性,分别用于图片的缓存和下载处理.虽然是核心类 ...

  5. HTTPS抓包之Charles

    这里对HTTP请求的抓包操作不做讲解了,只讲解HTTPS的抓包要进行的操作. [说明]:下面以MAC电脑示例,Windows版本可参考:http://weibo.com/ttarticle/p/sho ...

  6. 文件上传和WAF的攻与防

    Author:JoyChouDate:20180613 1. 前言 本文的测试环境均为 nginx/1.10.3 PHP 5.5.34 有些特性和 语言及webserver有关,有问题的地方,欢迎大家 ...

  7. python实现快速排序算法

    快速排序算法又称划分交换排序(partition-exchange sort),一种排序算法,最早由东尼·霍尔提出.在平均状况下, 排序n个项目要O(nlogn)次比较.在最坏状况下则需要O(n*2) ...

  8. Spring Boot日志集成实战

    Spring Boot日志框架 Spring Boot支持Java Util Logging,Log4j2,Lockback作为日志框架,如果你使用starters启动器,Spring Boot将使用 ...

  9. LeetCode--No.007 Reverse Integer

    7. Reverse Integer Total Accepted: 153147 Total Submissions: 644103 Difficulty: Easy Reverse digits ...

  10. [原创]Struts2奇葩环境任意文件上传工具(解决菜刀无法传文件或上传乱码等问题)

    上面这问题问得好  1 不知道大家有没碰到有些Strus2站点  上传JSP后访问404 或者503    注意我说的是404或503不是403(要是403换个css/img等目录或许可以)    但 ...