//获取某一Topic的目标路由列表 public void TestQueryTopicRouteTable() { DefaultAcsClient acsClient = Demo.IotClient.GetClient(); String SrcTopic = "/<productKey>/secondDevice/user/get"; QueryTopicRouteTableRequest request = new QueryTopicRouteTableRequest(); request.Topic = SrcTopic; QueryTopicRouteTableResponse response = acsClient.GetAcsResponse(request); Console.WriteLine("Query Topic Route Table: " + response.Success); if (!(bool)response.Success) { Console.WriteLine(response.Code + ", " + response.ErrorMessage); Console.ReadKey(); return; } List <String> dstTopics = response.DstTopics; for (int i = 0; i < dstTopics.Count; i += 1) { Console.WriteLine("Dsttopic: " + dstTopics[i]); } }
public static QueryTopicRouteTableResponse Unmarshall(UnmarshallerContext _ctx) { QueryTopicRouteTableResponse queryTopicRouteTableResponse = new QueryTopicRouteTableResponse(); queryTopicRouteTableResponse.HttpResponse = _ctx.HttpResponse; queryTopicRouteTableResponse.RequestId = _ctx.StringValue("QueryTopicRouteTable.RequestId"); queryTopicRouteTableResponse.Success = _ctx.BooleanValue("QueryTopicRouteTable.Success"); queryTopicRouteTableResponse.Code = _ctx.StringValue("QueryTopicRouteTable.Code"); queryTopicRouteTableResponse.ErrorMessage = _ctx.StringValue("QueryTopicRouteTable.ErrorMessage"); List <Dictionary <string, string> > queryTopicRouteTableResponse_dstTopics = new List <Dictionary <string, string> >(); for (int i = 0; i < _ctx.Length("QueryTopicRouteTable.DstTopics.Length"); i++) { Dictionary <string, string> tmp = new Dictionary <string, string>() { }; foreach (var _item in _ctx.ResponseDictionary) { string prefix = "QueryTopicRouteTable.DstTopics[" + i + "]."; if (_item.Key.IndexOf(prefix) == 0) { tmp.Add(_item.Key.Substring(prefix.Length), _item.Value); } } if (tmp.Count > 0) { queryTopicRouteTableResponse_dstTopics.Add(tmp); } } queryTopicRouteTableResponse.DstTopics = queryTopicRouteTableResponse_dstTopics; return(queryTopicRouteTableResponse); }
public static QueryTopicRouteTableResponse Unmarshall(UnmarshallerContext context) { QueryTopicRouteTableResponse queryTopicRouteTableResponse = new QueryTopicRouteTableResponse(); queryTopicRouteTableResponse.HttpResponse = context.HttpResponse; queryTopicRouteTableResponse.RequestId = context.StringValue("QueryTopicRouteTable.RequestId"); queryTopicRouteTableResponse.Success = context.BooleanValue("QueryTopicRouteTable.Success"); queryTopicRouteTableResponse.ErrorMessage = context.StringValue("QueryTopicRouteTable.ErrorMessage"); List <string> queryTopicRouteTableResponse_dstTopics = new List <string>(); for (int i = 0; i < context.Length("QueryTopicRouteTable.DstTopics.Length"); i++) { queryTopicRouteTableResponse_dstTopics.Add(context.StringValue("QueryTopicRouteTable.DstTopics[" + i + "]")); } queryTopicRouteTableResponse.DstTopics = queryTopicRouteTableResponse_dstTopics; return(queryTopicRouteTableResponse); }