Package

Source Code of TestAddShar

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.qq.open.qzone.bean.param.QqAddShareParamBean;
import com.qq.open.common.OpenQqException;
import com.qq.open.common.json.JSONException;
import com.qq.open.qzone.share.QqAddShare;


public class TestAddShar {

  /**
   * @param args
   * @throws JSONException
   * @throws IOException
   */
  public static void main(String[] args) throws IOException, JSONException {

    QqAddShareParamBean qqAddShareBean = new QqAddShareParamBean();
   
    qqAddShareBean.setAccessToken("138F0112CC9B350B8AE00899CB47D489");
   
    qqAddShareBean.setOpenId("2D78AAACEAF41021180BEAA2A47871B8");
   
    qqAddShareBean.setTitle("javaSdk-AddShare");
   
    qqAddShareBean.setUrl("http//code.qq.com");
   
    qqAddShareBean.setComment("这是测试内容,通过javaSDK2.0。Post");
   
    qqAddShareBean.setImages("http://code.qq.com/bbs/static/image/common/logo.png");
   
    qqAddShareBean.setSource("1");
   
   
    QqAddShare qqAddShare = new QqAddShare();
   
    Map<String,String> rMap = new HashMap<String,String>();
    try {
       qqAddShare.addShare(qqAddShareBean);
    } catch (OpenQqException e) {
      // TODO Auto-generated catch block
      List<String> mess = e.getErrorMess();
     
      for (String string : mess) {
        System.out.println(string);
      }
    }
   
    System.out.println(rMap.get("ret"));
    System.out.println(rMap.get("msg"));
  }

}
TOP

Related Classes of TestAddShar

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.