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 ...
随机推荐
- 获取Lambda表达式内表达式的值
随着Linq的盛行,对于Linq和Lmabda表达式的使用也越来越多,Lambda表达式在.net framework 3.5中提出来,Lambda表达式是一个匿名方法,通常在LINQ中被用来创建委托 ...
- channel和Stream的对比
这篇文章主要想总结下NIO的channel的传统io中的stream的差别在哪.网上找了很多文章,都感觉只是说了概念.然后自己大概看了下源码,结合概念,整理一下.有些地方可能不是很准确,也希望可以给点 ...
- Vuejs——(9)组件——props数据传递
版权声明:出处http://blog.csdn.net/qq20004604 目录(?)[+] 本篇资料来于官方文档: http://cn.vuejs.org/guide/components ...
- Apollo配置管理系统使用
- git 命令(提高篇)的本质理解
上一篇博客:[[git 命令(提高篇)的本质理解] (http://www.cnblogs.com/juking/p/7105744.html)]介绍了Git 的基础知识 -- 提交.分支以及在提交树 ...
- org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.SQLServerDriver '
问题摘要: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nest ...
- WebView 错误码整理
在使用WebView中,我们不可避免的会接触到WebView加载失败的异常处理的需求,这时候,需要我们监听失败的方法也就是onReceivedError方法: public class CustomW ...
- Android核心技术Intent和数据存储篇
女孩:上海站到了? 男孩:嗯呢?走向世界~ 女孩:Intent核心技术和数据存储技术? 男孩:对,今日就讲这个~ Intent是各个组件之间用来进行通信的,Intent的翻译为"意图&quo ...
- Ehcache3开发入门简介
在高并发应用中缓存就是核心机制.最近在研究Ehcache,发现这是一个更加灵活易用的缓存框架(相对于Redis.Memcache),Ehcache更加小巧轻便.而且都有持久化机制,不用担心JVM和服务 ...
- SSM工作流程的大致理解
//不是根据源码来理解的,所以细节有省略.. 首先从在浏览器输入URl的那一刻开始 例如输入 localhost:8080/MyProject/listCategory 初始化: 此时tomcat已经 ...