HTTP_JAVA短信接口示例

一、下載源碼

JAVA DEMO下載

備注: httpclient 方式引用1、httpclient.jar,2、httpcore.jar,3、commons-logging.jar,4、commons-codec.jar; jodd方式引用1、jodd-core.jar,2、jodd-http.jar,3、jodd-upload.jar。 具體版本號以下載示例源碼包中jar包的版本為準,如需要其他版本請自主下載。

二、使用幫助

2.1 DEMO結構

說明:
1、ApiDemo4HttpClient.java:江蘇美圣短信接口
2、開發環境引用第三方jar方式 maven方式:復制以下配置片段放在pom.xml中dependencies節點內
  

            org.apache.httpcomponents
            httpclient
            4.3.5

      
手工方式:點擊下載"引用jar包.rar"手工添加至項目工程中。

2.2 初始參數

	//賬號
	static String account = "JSM*****";
	//密碼
	static String password = "********";
	//通訊Key/校驗碼
	static String veryCode = "************";

2.3 接口使用

2.3.1 普通短信

public static String sendSms(String mobile,String content){
	String sendSmsUrl = http_url + "/service/httpService/httpInterface.do?method=sendUtf8Msg";
	Map<String,String> params = new HashMap<String,String>();
	params.put("username", account);
	params.put("password", password);
	params.put("veryCode", veryCode);
	params.put("mobile", mobile);
	params.put("content", content);
	params.put("msgtype", "1");
	params.put("code", "utf-8");
	String result = sendHttpPost(sendSmsUrl, params);
	return result;
}
如果賬號開了免審,或者是做模板短信,將會按照規則正常發送,而不會進人工審核平臺,返回值是:



0
48783a095b7e4c11a9f1a86b5f9b0357,bb3a1075aca34f588defde55d0b3d57c
	

2.3.2 模板短信

public static String sendTplSms(String mobile,String tplId,String content){
	String sendTplSmsUrl = http_url + "/service/httpService/httpInterface.do?method=sendUtf8Msg";
	Map<String,String> params = new HashMap<String,String>();
	params.put("username", account);
	params.put("password", password);
	params.put("veryCode", veryCode);
	params.put("mobile", mobile);
	params.put("content", content);	//變量值,以英文逗號隔開
	params.put("msgtype", "2");		//2-模板短信
	params.put("tempid", tplId);	//模板編號
	params.put("code", "utf-8");
	String result = sendHttpPost(sendTplSmsUrl, params);
	return result;
}



0
743ed1cf5c1a48059e46b5bddced4f4a
	

2.3.3 獲得狀態報告

public static String queryReport(){
	String reportUrl = http_url + "/service/httpService/httpInterface.do?method=queryReport";
	Map<String,String> params = new HashMap<String,String>();
	params.put("username", account);
	params.put("password", password);
	params.put("veryCode", veryCode);
	String result = sendHttpPost(reportUrl, params);
	return result;
}
只能查詢當天的,已獲取的狀態報告后續不會再獲取,返回值是:



159********
c9d6cdca60734906b35f846a1feb0622
DELIVRD


	

159********
74b8a704de1f498a8762dc66e02fd660
DELIVRD


	

2.3.4 獲得上行短信

public static String queryMo(){
	String moUrl = http_url + "/service/httpService/httpInterface.do?method=queryMo";
	Map<String,String> params = new HashMap<String,String>();
	params.put("username", account);
	params.put("password", password);
	params.put("veryCode", veryCode);
	String result = sendHttpPost(moUrl, params);
	return result;
}
只能查詢當天的,已獲取的上行短信后續不會再獲取,返回值:



159********
106905994540001
謝謝

	

159********
106905994540001
江蘇美圣信息技術有限公司

	

    

2.3.5 獲得余額

public static String getBalance(){
	String balanceUrl = http_url + "/service/httpService/httpInterface.do?method=getAmount";
	Map<String,String> params = new HashMap<String,String>();
	params.put("username",account);
	params.put("password",password);
	params.put("veryCode",veryCode);
	String result = sendHttpPost(balanceUrl, params);
	return result;
}
返回值是:



0
0
	

    
国产精品永久免费_国产精品无码素人福利_少妇上爽下爽12P_女人张腿让男桶免费视频在线观看
<menuitem id="f1znb"></menuitem>
<var id="f1znb"><span id="f1znb"><menuitem id="f1znb"></menuitem></span></var><cite id="f1znb"></cite><cite id="f1znb"></cite>
<cite id="f1znb"></cite>
<var id="f1znb"></var>
<menuitem id="f1znb"></menuitem>
<var id="f1znb"></var>
<cite id="f1znb"></cite>
<cite id="f1znb"><video id="f1znb"><thead id="f1znb"></thead></video></cite>
<var id="f1znb"><video id="f1znb"><thead id="f1znb"></thead></video></var>
<cite id="f1znb"></cite>
<var id="f1znb"><strike id="f1znb"></strike></var>
<var id="f1znb"></var>
<menuitem id="f1znb"></menuitem>