public static CreateTopicRouteTableResponse Unmarshall(UnmarshallerContext _ctx) { CreateTopicRouteTableResponse createTopicRouteTableResponse = new CreateTopicRouteTableResponse(); createTopicRouteTableResponse.HttpResponse = _ctx.HttpResponse; createTopicRouteTableResponse.RequestId = _ctx.StringValue("CreateTopicRouteTable.RequestId"); createTopicRouteTableResponse.Success = _ctx.BooleanValue("CreateTopicRouteTable.Success"); createTopicRouteTableResponse.Code = _ctx.StringValue("CreateTopicRouteTable.Code"); createTopicRouteTableResponse.IsAllSucceed = _ctx.BooleanValue("CreateTopicRouteTable.IsAllSucceed"); createTopicRouteTableResponse.ErrorMessage = _ctx.StringValue("CreateTopicRouteTable.ErrorMessage"); List <Dictionary <string, string> > createTopicRouteTableResponse_failureTopics = new List <Dictionary <string, string> >(); for (int i = 0; i < _ctx.Length("CreateTopicRouteTable.FailureTopics.Length"); i++) { Dictionary <string, string> tmp = new Dictionary <string, string>() { }; foreach (var _item in _ctx.ResponseDictionary) { string prefix = "CreateTopicRouteTable.FailureTopics[" + i + "]."; if (_item.Key.IndexOf(prefix) == 0) { tmp.Add(_item.Key.Substring(prefix.Length), _item.Value); } } if (tmp.Count > 0) { createTopicRouteTableResponse_failureTopics.Add(tmp); } } createTopicRouteTableResponse.FailureTopics = createTopicRouteTableResponse_failureTopics; return(createTopicRouteTableResponse); }
//新建Topic与Topic之间的路由关系 public void TestCreateTopicRouteTable() { DefaultAcsClient acsClient = Demo.IotClient.GetClient(); String SrcTopic = "/<productKey>/secondDevice/user/get"; CreateTopicRouteTableRequest request = new CreateTopicRouteTableRequest(); request.SrcTopic = SrcTopic; List <String> DstTopics = new List <string>(); DstTopics.Add("/<productKey>/device_0821_148/user/update"); request.DstTopics = DstTopics; CreateTopicRouteTableResponse response = acsClient.GetAcsResponse(request); Console.WriteLine("Create Topic Route Table: " + response.Success); if (!(bool)response.Success) { Console.WriteLine(response.Code + ", " + response.ErrorMessage); Console.ReadKey(); return; } bool isAllSucceed = true; if (response.IsAllSucceed != null) { isAllSucceed = (bool)response.IsAllSucceed; } List <Dictionary <string, string> > failedTopics = response.FailureTopics; Console.WriteLine("isAllSucceed: " + isAllSucceed + ", failedTopicCount: " + failedTopics.Count); }
public static CreateTopicRouteTableResponse Unmarshall(UnmarshallerContext context) { CreateTopicRouteTableResponse createTopicRouteTableResponse = new CreateTopicRouteTableResponse(); createTopicRouteTableResponse.HttpResponse = context.HttpResponse; createTopicRouteTableResponse.RequestId = context.StringValue("CreateTopicRouteTable.RequestId"); createTopicRouteTableResponse.Success = context.BooleanValue("CreateTopicRouteTable.Success"); createTopicRouteTableResponse.IsAllSucceed = context.BooleanValue("CreateTopicRouteTable.IsAllSucceed"); createTopicRouteTableResponse.ErrorMessage = context.StringValue("CreateTopicRouteTable.ErrorMessage"); List <string> createTopicRouteTableResponse_failureTopics = new List <string>(); for (int i = 0; i < context.Length("CreateTopicRouteTable.FailureTopics.Length"); i++) { createTopicRouteTableResponse_failureTopics.Add(context.StringValue("CreateTopicRouteTable.FailureTopics[" + i + "]")); } createTopicRouteTableResponse.FailureTopics = createTopicRouteTableResponse_failureTopics; return(createTopicRouteTableResponse); }