PackageCom.fenxiao.channel.quxun;Importjava.io.IOException;ImportJava.util.Map;Importorg.apache.commons.httpclient.HttpClient;Importorg.apache.commons.httpclient.HttpException;ImportOrg.apache.commons.httpclient.methods.PostMethod;ImportOrg.apache.log4j.LogManager;ImportOrg.apache.log4j.Logger;ImportCom.fenxiao.channel.qiannai.util.MD5Util;/*** 2.1. Product Order *@authorWN **/ Public classjiudianjiutest {@SuppressWarnings ("Unused") PrivateLogger log = Logmanager.getlogger (jiudianjiutest.class); @SuppressWarnings ({"Rawtypes"}) PublicObject Testorder ()throwshttpexception,ioexception{String accountval= "13301516477";//Mobile phone numberString Notifyurl = "https://www.baidu.com/";//Notification callback AddressString OrderNo = "23167771251045981811249827799033";//Channel Order CodeString supplierId = "KEDANG201605042323ERWG";//Channel CodeString spuid = "LT010020";//Product CodeString ts = system.currenttimemillis () + "";//time StampString sign = "";//SignatureString key = "kedang0504";//secret key//Stitching into stringsStringBuffer SB =NewStringBuffer (); Sb.append ("Accountval"). Append (Accountval). Append ("Notifyurl").). Append (Notifyurl). Append ("OrderNo"). Append (OrderNo). Append ("Spuid"). Append (Spuid). Append ("SupplierId"). Append (SupplierId). Append ("TS"). Append (TS). append (key); System.out.println ("33333" +sb.tostring ()); Sign=Md5util.encrypt (sb.tostring ()); String URL= "Http://cz.9dian9.cn/u/stdchn/kedang/charge.xml";//Request AddressHttpClient Client=NewHttpClient (); Client.getparams (). Setcontentcharset ("UTF-8"); Postmethod Postmethod=Newpostmethod (URL); String s= "supplierid=" +supplierid+ "&sign=" +sign+ "&spuid=" +spuid+ "&orderno=" +orderno+ "&accountVal=" + accountval+ "¬ifyurl=" +notifyurl+ "&ts=" +ts; System.out.println (s); Postmethod.addparameter ("SupplierId", supplierId);//Merchant NumberPostmethod.addparameter ("sign", sign);//SignaturePostmethod.addparameter ("Spuid", Spuid);//Product numberPostmethod.addparameter ("OrderNo", OrderNo);//Serial NumberPostmethod.addparameter ("Accountval", accountval);//Phone numberPostmethod.addparameter ("Notifyurl", Notifyurl);//Callback AddressPostmethod.addparameter ("ts", TS);//DateMap Resultmap =NULL; Client.executemethod (Postmethod); System.out.println (Postmethod.getresponsebodyasstring ()); returnResultmap; } Public Static voidMain (string[] args)throwsHttpException, IOException {jiudianjiutest test=Newjiudianjiutest (); Test.testorder (); } }
Interface Specification (product order)