主题 : 关于api 内容 新增 功能 |
级别: 商业授权用户
![]() |
1# 发表于:2017-08-28 20:09:08 IP:1.219.*.*
|
||||
---|---|---|---|---|---|
级别: 商业授权用户
![]() |
7# 发表于:2017-08-29 09:36:38 IP:1.219.*.*
回复第6楼
目的:通过增加接口,添加内容到cms中 api文档中接口信息 我代码中的接口 过程描述: 1. 我先通过user接口获取sessionKey 2. 用SessionKey+appId+appKey+aesKey+ivKey 形成参数; 3. 使用testContent中testSaveContent()添加内容 4. 然后 第一次运行方法可以添加数据内容,但是控制台打印错误信息,并且第二次运行时,控制台打印相同错误信息,但是不再添加数据 问题反馈: 控制台打印信息如下 res-><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>服务请求发生了错误!</title> <style type="text/css"> .body{background:url(../../res/jeecms/img/admin/lbg.jpg) #e9f4f8 right repeat-y;color:#666666;margin:auto;text-align: center;font-size: 50px;} </style> </head> <body class="body"> <p>服务请求发生了错误!</p> </body> </html> testContent()方法代码如下 private static String testSaveContent(){ System.out.println("====here===="); String url="http://localhost:8080/jeecms/api/content/save.jspx"; StringBuffer paramBuff=new StringBuffer(); paramBuff.append("&channelId="+75); paramBuff.append("&title="+"test07"); paramBuff.append("&txt=欢迎使用cms系统,本系统非常先进,功能俱全!!"); String nonce_str=RandomStringUtils.random(16,Num62.N62_CHARS); //String nonce_str="ofIcgEJdPN7FoGVY"; paramBuff.append("&appId="+appId); paramBuff.append("&nonce_str="+nonce_str); Map<String, String>param=new HashMap<String, String>(); String []params=paramBuff.toString().split("&"); for(String p:params){ String keyValue[]=p.split("="); if(keyValue.length==2){ param.put(keyValue[0], keyValue[1]); } } String encryptSessionKey=""; try { encryptSessionKey=AES128Util.encrypt(sessionKey, aesKey,ivKey); } catch (Exception e) { e.printStackTrace(); } paramBuff.append("&sessionKey="+encryptSessionKey); param.put("sessionKey", encryptSessionKey); String sign=PayUtil.createSign(param, appKey); paramBuff.append("&sign="+sign); param.put("sign", sign); System.out.println("url:"+url); System.out.println("param:"+param); try { String res=HttpClientUtil.getInstance().postParams(url, param); System.out.println("res->"+res); return res; } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return null; } |
||
---|---|---|---|
级别: 商业授权用户
![]() |
9# 发表于:2017-08-29 10:43:50 IP:1.219.*.*
回复第8楼
通过 调用 testContentApi.Java -->testSaveContent-->添加内容的时候报错。 |
||
---|---|---|---|