阿斯顿发送到发
注册SF
Java微信公众号开发进阶——access_token的获取 VII
微信公众号开发入门课程代码
asasfasfas
public static JSONObject doPostStr(String url, String outStr) { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); JSONObject jsonObject = null; try { httpPost.setEntity(new StringEntity(outStr, "UTF-8")); HttpResponse response = httpClient.execute(httpPost); String result = EntityUtils.toString(response.getEntity(), "UTF-8"); jsonObject = JSONObject.fromObject(result); } catch (Exception e) { e.printStackTrace(); } return jsonObject; }
XStream xstream=new XStream();
xstream.alias("xml",newsMessage.getClass());
xstream.alias("item",new News().getClass());
retrun xstream.toXML(newsMessage);
微信接收get请求依赖的jar包
如果无法获取票据信息,可以查看一下微信公众平台IP白名单是否没设置IP
消息对象的属性名称必须要和文档中的一模一样,重点在大小写,因为要转xml,如果小写了节点就不一样了