package main;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pojo.AccessToken;
import pojo.Article;
import pojo.Articles;
import util.WeixinUtil;
public class SendMedia {
private static Logger log = LoggerFactory.getLogger(MenuManager.class);
public static void main(String[] args) {
// 第三方用户唯一凭证
String appId = "lalala";
// 第三方用户唯一凭证密钥
String appSecret = "lalala";
// 调用接口获取access_token
AccessToken at = WeixinUtil.getAccessToken(appId, appSecret);
if (null != at) {
// 调用接口创建菜单
int result = WeixinUtil.createArticle(getArticle(), at.getToken());
// 判断菜单创建结果
if (0 == result)
log.info("上传图文消息成功!");
else
log.info("上传图文消息,错误码:" + result);
}
}
public static Articles getArticle(){
Article article = new Article();
article.setContent("---content---");
article.setContent_source_url("http://mp.weixin.qq.com/s?__biz=MzA5MzkxMjAxNQ==&mid=20647&idx=1&sn=4c17a84099d0e9498709927304179389&scene=18#rd");
article.setDigest("---digest---图文消息的描述");
** //就是这句话有问题thumb_media_id;
article.setThumb_media_id("qI6_Ze_6PtV7svjolgs-rN6stStuHIjs1_DidOHaj0Q-mwvBelOXCFZiq22sIU-p");**
article.setTitle("---title---标题");
Articles articles = new Articles();
articles.setArticles(new Article[]{article});
return articles;
}
}
抛出异常:
2015-6-10 22:56:14 util.WeixinUtil createArticle
严重: 上传图文消息失败: errcode:40007 errmsg:invalid media_id
2015-6-10 22:56:14 main.SendMedia main
信息: 上传图文消息,错误码:40007
求各位大神帮忙!!!