import java.math.*;
import java.security.MessageDigest;
import java.util.*;
import java.io.*;
import java.security.MessageDigest;
import java.util.*;
import java.io.*;
String sign="";
String bodyString="";
String bodyMD5="";
HashMap map=new HashMap();
map.put("userID", "${userID}");
map.put("name", "${name}");
map.put("orgCode", "${orgCode}");
map.put("idNumber", "${idNumber}");
map.put("idType", "${idType}");
map.put("type", "${type}");
map.put("userFrom", "${userFrom}");
String bodyString="";
String bodyMD5="";
HashMap map=new HashMap();
map.put("userID", "${userID}");
map.put("name", "${name}");
map.put("orgCode", "${orgCode}");
map.put("idNumber", "${idNumber}");
map.put("idType", "${idType}");
map.put("type", "${type}");
map.put("userFrom", "${userFrom}");
StringBuffer jsonBuffer = new StringBuffer();
Iterator iter = map.keySet().iterator();
jsonBuffer.append("{");
while(iter.hasNext()) {
String key =iter.next();
jsonBuffer.append("\""+key+"\"" + ":" +"\""+ map.get(key)+"\"");
if ( iter.hasNext()) {
jsonBuffer.append(",");
}
}
jsonBuffer.append("}");
jsonBuffer.append("{");
while(iter.hasNext()) {
String key =iter.next();
jsonBuffer.append("\""+key+"\"" + ":" +"\""+ map.get(key)+"\"");
if ( iter.hasNext()) {
jsonBuffer.append(",");
}
}
jsonBuffer.append("}");
//body
bodyString= jsonBuffer.toString();
vars.put("bodyString",bodyString);
bodyString= jsonBuffer.toString();
vars.put("bodyString",bodyString);
MessageDigest md = MessageDigest.getInstance("MD5");
//加密BODY
md.update(bodyString.getBytes());
bodyMD5 = new BigInteger(1, md.digest()).toString(16);
//获取SIGN
String signString="randString=${randString}&secret=${11111111}&body="+bodyMD5;
md.update(signString.getBytes());
sign = new BigInteger(1, md.digest()).toString(16);
vars.put("sign",sign);
//加密BODY
md.update(bodyString.getBytes());
bodyMD5 = new BigInteger(1, md.digest()).toString(16);
//获取SIGN
String signString="randString=${randString}&secret=${11111111}&body="+bodyMD5;
md.update(signString.getBytes());
sign = new BigInteger(1, md.digest()).toString(16);
vars.put("sign",sign);
SampleResult.setResponseData(sign);