public static CreateProductResponse Unmarshall(UnmarshallerContext _ctx)
        {
            CreateProductResponse createProductResponse = new CreateProductResponse();

            createProductResponse.HttpResponse = _ctx.HttpResponse;
            createProductResponse.RequestId    = _ctx.StringValue("CreateProduct.RequestId");
            createProductResponse.Success      = _ctx.BooleanValue("CreateProduct.Success");
            createProductResponse.Code         = _ctx.StringValue("CreateProduct.Code");
            createProductResponse.ErrorMessage = _ctx.StringValue("CreateProduct.ErrorMessage");
            createProductResponse.ProductKey   = _ctx.StringValue("CreateProduct.ProductKey");

            CreateProductResponse.CreateProduct_Data data = new CreateProductResponse.CreateProduct_Data();
            data.DataFormat          = _ctx.IntegerValue("CreateProduct.Data.DataFormat");
            data.Description         = _ctx.StringValue("CreateProduct.Data.Description");
            data.NodeType            = _ctx.IntegerValue("CreateProduct.Data.NodeType");
            data.ProductKey          = _ctx.StringValue("CreateProduct.Data.ProductKey");
            data.ProductName         = _ctx.StringValue("CreateProduct.Data.ProductName");
            data.AliyunCommodityCode = _ctx.StringValue("CreateProduct.Data.AliyunCommodityCode");
            data.Id2                   = _ctx.BooleanValue("CreateProduct.Data.Id2");
            data.ProtocolType          = _ctx.StringValue("CreateProduct.Data.ProtocolType");
            data.AuthType              = _ctx.StringValue("CreateProduct.Data.AuthType");
            data.ProductSecret         = _ctx.StringValue("CreateProduct.Data.ProductSecret");
            createProductResponse.Data = data;

            return(createProductResponse);
        }
Beispiel #2
0
        //创建一个节点类型是网关的产品,禁止动态注册设备到产品下
        public void TestCreateProduct()
        {
            CreateProductRequest request = new CreateProductRequest();

            request.ProductName         = "product_20190819";
            request.NodeType            = 1;
            request.AliyunCommodityCode = "iothub_senior";
            request.DataFormat          = 1;
            request.Id2          = false;
            request.ProtocolType = "modbus";
            request.NetType      = "WIFI";
            request.Description  = "Gateway use wifi.";
            request.AuthType     = "id2";

            DefaultAcsClient      acsClient = Demo.IotClient.GetClient();
            CreateProductResponse response  = acsClient.GetAcsResponse(request);

            Console.WriteLine(response.Success);
            Console.WriteLine(response.ErrorMessage);
            CreateProductResponse.CreateProduct_Data ProductInfo = response.Data;
            Console.WriteLine("product name: " + ProductInfo.ProductName);
            Console.WriteLine("product key: " + ProductInfo.ProductKey);
            Console.WriteLine("product description: " + ProductInfo.Description);
        }