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 ...
随机推荐
- opencv源码编写规则
OPENCV作为一种开源的计算机视觉库,我们有必要去了解这个库的一些编码格式及文件结构. 1.文档命名规则 必须将所有功能放入一个或多个.cpp和.hpp文件到OpenCV的相应模块中,或者如果贡献的 ...
- Vuejs(14)——在v-for中,利用index来对第一项添加class
版权声明:出处http://blog.csdn.net/qq20004604 (1)在v-for中,利用index来对第一项添加class <a class="list-group-i ...
- Ocelot使用
1.在网关项目中通过nuget引入Ocelot 2.Startup.cs文件代码调整 using System; using System.Collections.Generic; using Sys ...
- Win32 CMD批处理命令
1. win32批处理下,另开一个console执行进程X 使用start [/K|/C],示例: //------------------------------------------------ ...
- grid布局笔记学习一之父元素(容器)
HTML代码: <div id="box"> <div class="lbox box1" style="background: # ...
- vue-cli脚手架项目按需引入elementUI
https://www.jianshu.com/p/40da0ba35ac1 Couldn't find preset "es2015" relative to directory ...
- Taglist: Exuberant ctags (http://ctags.sf.net) not found in PATH. Plugin is not loaded
1 开发环境 Ubuntu16.04(64bit) 2 错误描述 安装好Vim的TagList插件后,打开Vim提示: 3 解决方法 根据参考资料[1]的提示,可知那是因为当前系统没有安装ctags导 ...
- 惊艳,Dubbo域名已改,也不再局限于Java!
今天作者想去 Dubbo 官网查下相关资料,发现官方域名由 dubbo.io 直接跳转至 dubbo.apache.org 下了,然后突然回想起 Dubbo 已经在 2 月份正式进入了 Apache ...
- win10 store 无法连接网络(原创)
当你试过所有的解决攻略 都无效时,那么使用这个教程 关闭以下的蓝色框里的
- hashmap可以用null为键值
import java.util.HashMap; import java.util.Map; import java.util.TreeMap; public class TestMain { ...