现在访问的链接,比如:www.api.com/userid?username=1&guid=1,但是我不知道怎么拼接上去,addParameter两个也不对。请问可以打印出访问的链接吗?或者怎么拼接上去
以下是代码
: public static String MethodsGeneral(String url,String methods,String soapurl, Map params,String str) {
Service service = new Service();
String res=null;
String jsonObjects=null;
Call call;
try {
call = (Call) service.createCall();
call.setTargetEndpointAddress(url);//请求的地址
call.addParameter(str,org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//设置参数
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回参数
//加密参数
JSONObject jsonObject = new JSONObject(params);
HashMap<String, String> allParam = new HashMap();
String beforeEnc = jsonObject.toString();
String cipherInfo = null;
try {
cipherInfo = AESUtil.encrypt(beforeEnc);
} catch (Exception e) {
e.printStackTrace();
}
// 把加密后的字符串转化为16进制
String temp = StringUtil.str2HexStr(cipherInfo);
allParam.put(str, temp);
call.setOperationName(methods);//访问的方法名
call.setSOAPActionURI(soapurl);//请求头
System.out.println(temp+"&GUID=7b33dd14-b183-4d1e-8c96-04baf421498f");
res=(String) call.invoke(new Object[] {temp});