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. IIS 设置文件传输大小限制

    IIS默认传输文件大小为30M,最大允许传输为2G. 1.通过webconfig配置节点设置 在IIS 6.0 设置如下配置节点: 但是IIS 7.0-8.0还要做添加如下配置节点才能正确,否则还是默 ...

  2. IntelliJ IDEA的破解方法

    一.下载并安装, IntelliJ IDEA的官网:https://www.jetbrains.com 下载 下载 下载 二.破解. 百度下载一个 JetbrainsCrack-2.7-release ...

  3. 进程池、tornado、字体

    协程:   import grequests from fake_useragent import UserAgent   urls=[f'http://bir删d.so/search?page={p ...

  4. InnoDB体系架构(三)Checkpoint技术

    Checkpoint技术 前篇 InnoDB体系架构(二)内存 从缓冲池.缓冲池的管理.重做日志缓冲.额外内存缓冲这四个点介绍了InnoDB存储引擎的内存结构,而在将缓冲池的数据刷新到磁盘的过程中使用 ...

  5. PHP合并数组

    1.arrary_merge 示例代码: $arr1 = array(1, 2, 3, 4, 5); $arr2 = array(1, 2, 6, 7, 8, 9, 10); $result1 = a ...

  6. ios webview下footer部分fixed失效问题

    场景: 如下图所示,一个很正常的页面需求,footer固定在底部,中间为滚动内容区 然后footer的css一般是这样的 footer{ position:fixed; bottom:; left:; ...

  7. struts2框架学习笔记7:struts2标签

    三大标签: 1.JSP:脚本,为了替代servlet,已过时 2.JSTL:标准标签库(core.format.sql.xml),还未淘汰的只有core库 3.Struts2标签库:由Struts2开 ...

  8. liunx下判断有线网口硬件是否正常的三个常用方式

    第一种,命令法: /mnt/wifi$ cat /proc/net/dev Inter-|  Receive                                              ...

  9. 干货:教你如何监控 Java 线程池运行状态

    之前写过一篇 Java 线程池的使用介绍文章<线程池全面解析>,全面介绍了什么是线程池.线程池核心类.线程池工作流程.线程池分类.拒绝策略.及如何提交与关闭线程池等. 但在实际开发过程中, ...

  10. [CTSC1999] 家园

    使用并查集判断无解. 令月球是n+1,地球是0 枚举时长t,将点(地球.月球以及太空站)i拆为t个点(i,j)表示第j时刻的点i. 对于太空船云云建图,容量是h[i]. 源点S和(0,0)连边,容量k ...