这种东西最好查阅快递100官方文档api,里面接口写的非常详细
废话不多说,直接上代码
首先是订阅模式
/**
* 订阅请求
*
*/
public class Demo {
public static void main(String[] args) {
String key = “这个是你在官网申请的授权秘钥”; //企业授权key
String company = “zhongtong”; //快递公司编码
String number = “7515829985”; //快递单号
String from = “”; //出发地城市
String to = “”; //目的地城市
String callbackurl = “http://ip:port/rollbackKuaiDi100”; //回调地址
String salt = “”; //加密串
int resultv2 = 1; //行政区域解析
int autoCom = 0; //单号智能识别
int interCom = 0; //开启国际版
String departureCountry = “”; //出发国
String departureCom = “”; //出发国快递公司编码
String destinationCountry = “”; //目的国
String destinationCom = “”; //目的国快递公司编码
String phone = “”; //手机号
SubscribeDemo demo = new SubscribeDemo(key);
String result = demo.subscribeData(company, number, from, to, callbackurl, salt, resultv2, autoCom, interCom, departureCountry, departureCom, destinationCountry, destinationCom, phone);
System.out.println(result);
}
/**
* 实时查询请求地址
*/
private static final String SUBSCRIBE_URL = "http://poll.kuaidi100.com/poll";
private String key; //授权key
public SubscribeDemo(String key) {
this.key = key;
}
/**
* 订阅请求方法
* @param company 快递公司编码
* @param number 快递单号
* @param from 出发地城市
* @param to 目的地城市
* @param callbackurl 回调地址URL
* @param salt 加密签名字符串
* @param resultv2 行政区域解析
* @param autoCom