Beispiel #1
0
        /// <summary>
        /// 获取地址
        /// </summary>
        /// <returns></returns>
        PacResponse SubscriptionQueryResponse()
        {
            var req = new TmsWaybillSubscriptionQueryRequest();

            req.cpCode = "ZTO";
            TmsWaybillSubscriptionQueryResponse rep = pacClient.Send(req, dailyToken);

            if (rep.Success == false)
            {
                LogHelper.WriteLog(typeof(TmsWaybillSubscriptionQueryResponse), rep.ErrorMsg);
            }
            return(rep);
        }
        public void GetDianZiDanHaoTest()
        {
            //加载配置
            AppSecretConfigSection configSection = ConfigHelper.GetConfigSection <AppSecretConfigSection>(AppSecretConfigSection.SectionName);

            string appkey    = configSection.CaiNiao.AppKey;
            string appSecret = configSection.CaiNiao.AppSecret;
            string url       = configSection.CaiNiao.PacUrl;
            string token     = "TmpFU1ZOUGoyRnoybDZmT3lyaW9hWGR4VFNad0xNYTBUek9QZk9kamt2Z1hJMytsVkVHK0FjVW55T25wcUR1Qw==";

            //正式     WkFhU2ZYdnA2dkFPd2MvVlR2OTF6K2FuQ1NKejdrV0V1ZDE3VS8zTW9uQjhLOGx5VHBuUkgyMzgrc3Q1RnRZNw==
            token = "WkFhU2ZYdnA2dkFPd2MvVlR2OTF6K2FuQ1NKejdrV0V1ZDE3VS8zTW9uQjhLOGx5VHBuUkgyMzgrc3Q1RnRZNw==";
            var    client    = new PacClient(appkey, appSecret, url);
            string jsonParas = "{\"cpCode\":\"ZTO\"}";
            TmsWaybillSubscriptionQueryRequest parasModel = jsonParas.FromJsonToObject <TmsWaybillSubscriptionQueryRequest>();

            parasModel.SoapFormat = PacSupportFormat.JSON;

            var resp = client.Send(parasModel, token);

            Assert.IsNotNull(resp);
        }