基本信息
源码名称:物联网通信RESTDemo示例程序(C#版本)
源码大小:2.12M
文件格式:.zip
开发语言:C#
更新时间:2020-04-22
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

Server开放RESTful API接口,供应用程序/移动App/嵌入式qt通过http post调用,实现获取服务端数据,更新服务器数据



using System.ServiceModel;
using System.ServiceModel.Web;

namespace ResetServer
{
    [ServiceContract]
    public interface IService
    {
        // 测试接口
        [OperationContract]
        [WebInvoke(Method = "POST",
                UriTemplate = "Test",
                ResponseFormat = WebMessageFormat.Json,
                BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        string Test();

        // 多个参数接口
        [OperationContract]
        [WebInvoke(Method = "POST",
                UriTemplate = "MultiParam",
                ResponseFormat = WebMessageFormat.Json,
                BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        string MultiParam(string strParam1, string strParam2);

        // 查询Sql语句(未加密)
        [OperationContract]
        [WebInvoke(Method = "POST",
                UriTemplate = "GetDataTable",
                ResponseFormat = WebMessageFormat.Json,
                BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        string GetDataTable(string strSql);

        // 查询Sql语句(DES加密)
        [OperationContract]
        [WebInvoke(Method = "POST",
                UriTemplate = "GetDataTable_DES",
                ResponseFormat = WebMessageFormat.Json,
                BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        string GetDataTable_DES(string strSql);

        // 执行Sql语句(未加密)
        [OperationContract]
        [WebInvoke(Method = "POST",
                UriTemplate = "ExecuteNonQuery",
                ResponseFormat = WebMessageFormat.Json,
                BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        string ExecuteNonQuery(string strSql);

        // 执行Sql语句(DES加密)
        [OperationContract]
        [WebInvoke(Method = "POST",
                UriTemplate = "ExecuteNonQuery_DES",
                ResponseFormat = WebMessageFormat.Json,
                BodyStyle = WebMessageBodyStyle.WrappedRequest)]
        string ExecuteNonQuery_DES(string strSql);
    }
}