南海区行政审批管理系统接口规范v0.3(规划)4.2.【queryExpireList】当天到期业务查询
加密前:{"time":"1510053168455","username":"GH_DATA_EXCHANGE","password":"15E45RRM"}
加密后:eyJ0aW1lIjoiMTUxMDA1MzE2ODQ1NSIsInVzZXJuYW1lIjoiR0hfREFUQV9FWENIQU5HRSIsInBh
c3N3b3JkIjoiMTVFNDVSUk0ifQ== %7B%22r_code%22%3A%22200%22%2C%22r_msg%22%3A%22%E7%99%BB%E5%BD%95%E6%88%90%E5%8A%9F%22%2C%22count%22%3A0%2C%22data%22%3A%220ef9e732-008d-4875-a8d2-60abde59ba60%22%7D
{"r_code":"200","r_msg":"登录成功","count":0,"data":"0ef9e732-008d-4875-a8d2-60abde59ba60"}
转码前:%7B%22r_code%22%3A%22200%22%2C%22r_msg%22%3A%22%E7%99%BB%E5%BD%95%E6%88%90%E5%8A%9F%22%2C%22count%22%3A0%2C%22data%22%3A%220ef9e732-008d-4875-a8d2-60abde59ba60%22%7D
转码后:{"r_code":"200","r_msg":"登录成功","count":0,"data":"0ef9e732-008d-4875-a8d2-60abde59ba60"}
data<--->0ef9e732-008d-4875-a8d2-60abde59ba60
%7B%22r_code%22%3A%22200%22%2C%22r_msg%22%3A%22%E6%93%8D%E4%BD%9C%E6%88%90%E5%8A%9F%22%2C%22count%22%3A0%2C%22data%22%3A%5B%5D%7D
{"r_code":"200","r_msg":"操作成功","count":0,"data":[]}
转码前:%7B%22r_code%22%3A%22200%22%2C%22r_msg%22%3A%22%E6%93%8D%E4%BD%9C%E6%88%90%E5%8A%9F%22%2C%22count%22%3A0%2C%22data%22%3A%5B%5D%7D
转码后:{"r_code":"200","r_msg":"操作成功","count":0,"data":[]}
{"r_code":"200","r_msg":"操作成功","count":0,"data":[]}
package queryExpireList;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
//import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection; import com.rl.client1.TestLogin2Action;
import net.sf.json.JSONException;
import net.sf.json.JSONObject; //import org.json.JSONException;
//import org.json.JSONObject; import test.BASE64;
public class QueryExpireList {
public static String query(String username,String password){
//定义WebService的URL
//URL url = new URL("http://10.168.20.12:8888/fsWebServiceWebHall/business/login.action");
//URL url = new URL("http://10.168.13.108/fsWebServiceWebHall/business/login2.action");
//URL url = new URL("http://10.168.13.108/fsWebServiceWebHall/business/login.action");
URL url;
PrintWriter ptout = null;
InputStream in = null;
StringBuffer sb = null;
String apptoken = null;
try {
//url = new URL("http://10.168.20.12:8888/fsWebServiceWebHall/business/login2.action");
//url = new URL("http://10.168.41.107:8080/fsWebServiceWebHall/business/login2.action");
url = new URL("http://10.168.20.12:8888/fsWebServiceWebHall/business/queryExpireList.action");
//打开连接获得URLConnection
HttpURLConnection uc = (HttpURLConnection)url.openConnection();
//打开输入输出的开关
uc.setDoInput(true);
uc.setDoOutput(true);//开启输入输出
//设置Connection
uc.setRequestProperty("connection", "Keep-Alive");
//设置Accept
uc.setRequestProperty("accept", "*/*"); uc.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); //组装消息体
apptoken = TestLogin2Action.getLogin(username, password);
//根据HttpURLConnection获得输出流
OutputStream out = uc.getOutputStream();
// 获取URLConnection对象对应的输出流
ptout = new PrintWriter(out);
// 发送请求参数
//ptout.print("appkey="+appkey);
ptout.print("apptoken="+apptoken);
// flush输出流的缓冲
ptout.flush();
//out.write(encodeappkey.getBytes());
//int httpCode = httpuc.getResponseCode();
//System.out.println(httpCode);
//如果请求成功
//if(httpuc.getResponseCode()==200){
//获得输入流
in = uc.getInputStream();//通过输入流把消息接收完
//使用输入缓冲区
BufferedReader br = new BufferedReader(new InputStreamReader(in,"utf-8"));
//写Socket的那种输入流的方式来读它
String line = null;
//读取响应的消息
sb = new StringBuffer();
while((line = br.readLine())!=null ){
sb.append(line);
}
}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} //使用finally块来关闭输出流、输入流
finally{
try{
if(ptout!=null){
ptout.close();
}
if(in!=null){
in.close();
}
}
catch(IOException ex){
ex.printStackTrace();
}
}
String decodesb = "";
System.out.println(sb.toString());
try {
decodesb = java.net.URLDecoder.decode(sb.toString(),"UTF-8");
System.out.println(decodesb);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("转码前:"+sb);
System.out.println("转码后:" + decodesb);
/*// 创建JSON解析对象(两条规则的体现:大括号用JSONObject,注意传入数据对象)
JSONObject obj;
String data = null;
try {
//obj = new JSONObject(decodesb);
obj = JSONObject.fromObject(decodesb);
//obj.后面有各种数据类型,根据对象来选择使用的数据类型
data = obj.getString("data");
// 同理如上,这里的age为Int类型,我们就用对应的类型进行解析
//int age = obj.getInt("age");
// 最后输出到控制台
System.out.println("data"+"<--->"+data);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} */
return decodesb; }
public static void main(String[] args){
//String queryExpireList = QueryExpireList.query("0216", "1234");
//String apptoken = TestLogin2Action.getLogin("GH_DATA_EXCHANGE","15E45RRM");
String queryExpireList = QueryExpireList.query("GH_DATA_EXCHANGE", "15E45RRM");
System.out.println(queryExpireList);
}
public static void main1(String[] args){ //定义WebService的URL
//URL url = new URL("http://10.168.20.12:8888/fsWebServiceWebHall/business/login.action");
//URL url = new URL("http://10.168.13.108/fsWebServiceWebHall/business/login2.action");
//URL url = new URL("http://10.168.13.108/fsWebServiceWebHall/business/login.action");
URL url;
PrintWriter ptout = null;
InputStream in = null;
StringBuffer sb = null;
try {
//url = new URL("http://10.168.20.12:8888/fsWebServiceWebHall/business/login2.action");
url = new URL("http://10.168.20.12:8888/fsWebServiceWebHall/business/queryExpireList.action");
//打开连接获得URLConnection
URLConnection uc = url.openConnection();
//强转成HttpURLConnection
//HttpURLConnection httpuc = (HttpURLConnection) uc;
//打开输入输出的开关
uc.setDoInput(true);
uc.setDoOutput(true);//开启输入输出
//设置请求方式
//uc.setRequestMethod("POST");
//设置Connection
uc.setRequestProperty("connection", "Keep-Alive");
//设置Charset
//httpuc.setRequestProperty("Charset", "UTF-8");
//设置Accept
//httpuc.setRequestProperty("Accept", "application/json");
uc.setRequestProperty("accept", "*/*");
//设置content-type
//httpuc.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
//httpuc.setRequestProperty("Content-Type", "text/html");
uc.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); //组装消息体
//String data = "c1f2e41650919327d85367194f75d4cf6a5f39dcef42ae6a3c33015ca92935009d6c6c4ed59a67637d54f29f7e77b9e2af95afddd4dc77b28a3d1d5056a52fe11ea6f735f35d8b62b3c2ebd9d43e533d";
/*
Date date = new Date();
DateFormat dateTimeformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//DateFormat dateTimeformat = new SimpleDateFormat("yyyyMMddHHmmss");
String strBeginDate = dateTimeformat.format(date);
System.out.println(date);
System.out.println(strBeginDate);
String appkey = "02161234"+date;
appkey = "02241234"+strBeginDate;
String data = java.net.URLEncoder.encode(appkey, "utf-8");
System.out.println("编码后:" + data);//加密后 */
String username = "GH_DATA_EXCHANGE"; // 用户账号
String password = "15E45RRM"; // 密码
long time = System.currentTimeMillis(); // 当前时间,毫秒
//String str="{\"username\":"+ username +",\"password\":"+ password +",\"time\": "+ time +"}"; // 原数据
//String str="{\"username\":"+ username +",\"password\":"+ password +",\"time\":"+ time +"}"; // 原数据
//String str="{\"time\":"+ time +",\"username\":"+ username +",\"password\":"+ password +"}"; // 原数据
String str = "{\"time\":\""+time+"\",\"username\":\""+username+"\",\"password\":\""+password+"\"}"; // 原数据
//String str = username+password+time;
//String appkey = AES.method1(str);
System.out.println("加密前:"+str);
//SymmetricEncoder se=new SymmetricEncoder();
//String appkey = se.AESEncode("使用AES对称加密", str);
//System.out.println("根据输入的规则"+"使用AES对称加密"+"加密后的密文是:"+se.AESEncode("使用AES对称加密", str));
//System.out.println("根据输入的规则"+"使用AES对称解密"+"解密后的明文是:"+se.AESDncode("使用AES对称解密",se.AESEncode("使用AES对称加密", str)));
//System.out.println("根据输入的规则"+"使用AES对称解密"+"解密后的明文是:"+se.AESDncode("使用AES对称解密",appkey));
//System.out.println("加密后:" + appkey); // 加密后
//appkey = "fB75+Z+CXIuVwqDNJYbKzZmHuVGORfL9TxqEx5AXE5w=";
// String encode = java.net.URLEncoder.encode(str,"utf-8");
// System.out.println("编码后:" + encode);
String appkey = BASE64.encryptBASE64(str.toString().getBytes());
//String appkey = new sun.misc.BASE64Encoder().encode(str.toString().getBytes());
// String appkey = BASE64.encryptBASE64(encode.getBytes());
//appkey = "eyJ1c2VybmFtZSI6Imd6OTkiLCJwYXNzd29yZCI6IjEyMzQiLCJ0aW1lIjogMTQ0ODQzMjY3NTE5NH0=";
//appkey = "c1f2e41650919327d85367194f75d4cf6a5f39dcef42ae6a3c33015ca92935009d6c6c4ed59a67637d54f29f7e77b9e2af95afddd4dc77b28a3d1d5056a52fe11ea6f735f35d8b62b3c2ebd9d43e533d";
System.out.println("加密后:"+appkey);
//String data = "eyJ1c2VybmFtZSI6Imd6OTkiLCJwYXNzd29yZCI6IjEyMzQiLCJ0aW1lIjogMTQ0ODQzMjY3NTE5NH0=";
/* Date date = new Date();
String appkey = "02241234"+date;
String data = java.net.URLEncoder.encode(appkey, "utf-8");
System.out.println("编码后:" + data);//加密后
*/ //根据HttpURLConnection获得输出流
OutputStream out = uc.getOutputStream(); //用输出流把消息发送到服务端
//out.write(data.getBytes());//已经把消息给写过去了.
//System.out.println(appkey.getBytes());
//String encodeappkey = java.net.URLEncoder.encode(appkey,"utf-8");
//out.write(appkey.getBytes());//已经把消息给写过去了.
// 获取URLConnection对象对应的输出流
ptout = new PrintWriter(out);
// 发送请求参数
ptout.print("appkey="+appkey);
// flush输出流的缓冲
ptout.flush();
//out.write(encodeappkey.getBytes());
//int httpCode = httpuc.getResponseCode();
//System.out.println(httpCode);
//如果请求成功
//if(httpuc.getResponseCode()==200){
//获得输入流
in = uc.getInputStream();//通过输入流把消息接收完
//使用输入缓冲区
BufferedReader br = new BufferedReader(new InputStreamReader(in,"utf-8"));
//写Socket的那种输入流的方式来读它
String line = null;
//读取响应的消息
sb = new StringBuffer();
while((line = br.readLine())!=null ){
sb.append(line);
}
}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} //使用finally块来关闭输出流、输入流
finally{
try{
if(ptout!=null){
ptout.close();
}
if(in!=null){
in.close();
}
}
catch(IOException ex){
ex.printStackTrace();
}
}
String decodesb = null;
try {
decodesb = java.net.URLDecoder.decode(sb.toString(),"UTF-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("转码前:"+sb);
System.out.println("转码后:" + decodesb); // 创建JSON解析对象(两条规则的体现:大括号用JSONObject,注意传入数据对象)
JSONObject obj;
try {
//obj = new JSONObject(decodesb);
obj = JSONObject.fromObject(decodesb);
//obj.后面有各种数据类型,根据对象来选择使用的数据类型
String data = obj.getString("data");
// 同理如上,这里的age为Int类型,我们就用对应的类型进行解析
//int age = obj.getInt("age");
// 最后输出到控制台
System.out.println("data"+"<--->"+data);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//StringBuffer是一个可变字符串,我们要把它变成一个文档来解析
//java代码里面解析XML
//解析消息,定义读取器对象SAXReader
/*SAXReader reader = new SAXReader();
//获得文档对象
Document doc = reader.read(new StringReader(sb.toString()));//它的返回值是一个文档对象Document
//使用XPath的方式获得到return这个元素的集合
List<Element> eList = doc.selectNodes("//return");
//遍历元素集合
for (Element element : eList) {
System.out.println(element.getText());
}*/ }
}
//}
南海区行政审批管理系统接口规范v0.3(规划)4.2.【queryExpireList】当天到期业务查询的更多相关文章
- 南海区行政审批管理系统接口规范v0.3(规划) 2.业务申报API 2.1.businessApply【业务申报】
{"v_interface":"2015987654327","c_project":"NH09A102"," ...
- 南海区行政审批管理系统接口规范v0.3(规划) 3.业务办理API 3.1.businessAuditById【业务办理】
{"c_accept":"Q2015112400002","c_operators":"gz99","v_op ...
- 南海区行政审批管理系统接口规范v0.3(规划)
1. 会话API 1.1. login [登录验证] {"r_code":"500","r_msg":"操作失败",&q ...
- 南海区行政审批管理系统接口规范v0.3(规划)4.1.【queryAcceptById】业务明细查询
加密前:{"time":"1510061005493","username":"GH_DATA_EXCHANGE",&q ...
- 南海区行政审批管理系统接口规范v0.3(规划) 5.投资项目联合审批系统API 5.1.【uploadFile】证件文书附件上传
- 通用权限管理系统数据字典 V3.9 版本,欢迎开发个各种业务系统的朋友们,参考表结构
C#.NET通用权限管理系统组件数据字典 导 航 ◇ (01) BaseItemDetails ◇ (02) BaseItems ◇ (03) BaseLog ◇ (04) BaseMessage ...
- Django学习——Django测试环境搭建、单表查询关键字、神奇的双下划线查询(范围查询)、图书管理系统表设计、外键字段操作、跨表查询理论、基于对象的跨表查询、基于双下划线的跨表查询
Django测试环境搭建 ps: 1.pycharm连接数据库都需要提前下载对应的驱动 2.自带的sqlite3对日期格式数据不敏感 如果后续业务需要使用日期辅助筛选数据那么不推荐使用sqlite3 ...
- 发现 一个业务管理系统 解决了 orm 和 前端框架 剩下的 是 业务逻辑 了 。 哈
解决了 orm 和 前端框架 剩下的 是 业务逻辑 了 . 哈 还有 各种 aop 组件 呢 . 大家 high 来 准备 用 fluent data 和 mysql 写一个 wcf 的 接口呢. ...
- #干货#小微信贷风控中类IPC模式和集中审批模式
浅析小微信贷风控中类IPC模式和集中审批模式 席占斌 常言道瑕不掩瑜,反过来讲瑜自然也不能掩瑕,看问题需要客观公正辩证. 在小微信贷中,风控模式依旧是核心,目前比较流行和占比较大的风控模式有很经典的I ...
随机推荐
- intellij IDEA常见操作
1.中文乱码设置:file - setting - Editor - File Encodings 设置为UTF-8 2.tomcat重新启动:Ctrl-F5,或者左上角 3.删除progect 先c ...
- Leetcode0092 & 0206--Reverse Linked List 链表逆转
[转载请注明]http://www.cnblogs.com/igoslly/p/8670038.html 链表逆序在链表题目中还是较为常见的,这里将Leetcode中的两道题放在一起,分别是 0092 ...
- 项目平台统一(前后端IDE、代码风格)
项目平台统一(前后端IDE.代码风格) 记录人:娄雨禛 前端:Webstorm(HTML+CSS+JavaScript) 后端:IntelliJ IDEA(Java) 代码风格:Java风格代码 代码 ...
- php数据库批量删除
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...
- SAP computer之program counter
Program counter The program is stored in memory with the first instruction at binary address 0000, t ...
- sql 查询替换字符
Select A,B,C from Tb1 –查询所有 Select A,replace(B,’1’,’壹’),C from Tb1 替换查询 Tb1 A B C AA1 1 CC A ...
- jquery相关常用的工具函数
1.弹出提示框: function prompt(msg){ $("<div>" + msg + "</div>").css({ &qu ...
- Django--form组件cookie/session
Field required=True, 是否允许为空 widget=None, HTML插件 label=None, 用于生成Label标签或显示内容 initial=None, 初始值 help_ ...
- javascript 数组 常用方法
前言 学学忘忘 闲来做个笔记 整理下数组常用方法. Array 数组常用方法 创建数组的基本方式有两种 1.第一种是使用Array构造函数, var arr = new Array(); ...
- call,apply,bind
1.IE5之前不支持call和apply,bind是ES5出来的;2.call和apply可以调用函数,改变this,实现继承和借用别的对象的方法; 1 call和apply定义 调用方法,用一个对象 ...