文档章节

微信公众平台深度开发JAVA版第一季 13.响应被动消息1

blueheart
 blueheart
发布于 2017/05/15 15:36
字数 2506
阅读 9
收藏 0

图文消息很复杂,放在下一讲统一处理.

package net.wxinterface;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.security.MessageDigest;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.dom4j.DocumentException;

import wx.in.In_Image;
import wx.in.In_Text;
import wx.in.In_Util;
import wx.out.Out_Text;

import com.imooc.po.TextMessage;
import com.imooc.util.MessageUtil;
public class WX_Interface extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public WX_Interface() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		//΢�ż���ǩ��,signature����˿�������д��tocken����������е�timestamp����nonce����
		String signature = request.getParameter("signature");
		//ʱ���
		String timestamp = request.getParameter("timestamp");
		//����� 
		String nonce = request.getParameter("nonce");
		
		String echostr = request.getParameter("echostr");
		
		String tocken = "test";
		try{
			if(null != signature){
			String[] ArrTmp = {tocken,timestamp,nonce};	
			Arrays.sort(ArrTmp);
			StringBuffer sb = new StringBuffer();
			for(int i=0;i<ArrTmp.length;i++){
				sb.append(ArrTmp[i]);
			}
			MessageDigest md = MessageDigest.getInstance("SHA-1");
			byte[] bytes = md.digest(new String(sb).getBytes());
			StringBuffer buf = new StringBuffer();
			for(int i=0;i<bytes.length;i++){
				if(((int)bytes[i] & 0xff)<0x10){
					buf.append("0");
				}
				buf.append(Long.toString((int) bytes[i] & 0xff,16));
				
			}
			if(signature.equals(buf.toString())){
				response.getOutputStream().println(echostr);
			}
		}
	}catch(Exception e){
			e.printStackTrace();
		}
		
		System.out.println("test0");

		
		System.out.println("doGet");
		System.out.println("signature     "+signature);
		System.out.println("timstamp      "+timestamp);
		System.out.println("nonce         "+nonce);
		System.out.println("echostr         "+echostr);
		
		
		System.out.println("doGet");
	
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		/*request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
try {
	Map<String,String> map = MessageUtil.xmlToMap(request);
	String fromUserName = map.get("FromUserName");
			String toUserName = map.get("ToUserName");
					String msgType = map.get("MsgType");
					String content = map.get("Content");//
					String message = null;
					
					//if("text".equals(msgType)){
					if(MessageUtil.MESSAGE_TEXT.equals(msgType)){
					if("1".equals(content)){
						message = MessageUtil.initText(toUserName,fromUserName,MessageUtil.firstMenu());				
					}else if("3".equals(content)){
						//message = MessageUtil.initText(toUserName,fromUserName,content);				
					//�Ϳ��������ﰴ3����ͼƬ��Ϣ,���ͼƬ��Ϣ�Ĵ����Լ��ظ��Ѿ�д����
						message = MessageUtil.initImageMessage(toUserName,fromUserName);
					}else if("4".equals(content)){//��servlet����һ���ж�,������4��ʱ��ظ�һ�����ָ���  
						message = MessageUtil.initMusicMessage(toUserName,fromUserName);
					}else if("2".equals(content)){
						//message = MessageUtil.initText(toUserName,fromUserName,MessageUtil.secondMenu());			
                        //�����ͼ����Ϣ�Ĵ����Լ��ظ��Ѿ�д���� 
						message= MessageUtil.initNewsMessage(toUserName,fromUserName);
					}else if("?".equals(content)||" ? ".equals(content)){
						message = MessageUtil.initText(toUserName,fromUserName,MessageUtil.menuText());
					}
						TextMessage text = new TextMessage();
					text.setFromUserName(toUserName);//˭������,��ͷ���˭
					text.setToUserName(fromUserName);
					text.setMsgType("text");
					text.setCreateTime(new Date().getTime());
					text.setContent("���͵���Ϣ��:"+content);
					 message = MessageUtil.textMessageToXml(text);
					
					System.out.println(message);
					}else if(MessageUtil.MESSAGE_EVENT.equals(msgType)){//�����Ϣ���͵��߼�
						String eventType = map.get("Event");
						if(MessageUtil.MESSAGE_SUBSCRIBE.equals(eventType)){//��Ϣ�����¼�������
							message = MessageUtil.initText(toUserName, fromUserName, content);//��ע΢�Ź��ں�֮��΢�ź�̨����
						}//�������Servlet�������һ���߼����ж�
						else if(MessageUtil.MESSAGE_CLICK.equals(eventType)){//�����������Click�˵���һ���¼�����
							//Click���͵���Ϣ����,���Event��Click���͵Ļ�,��ô����ظ�һ�����˵�
							message = MessageUtil.initText(toUserName, fromUserName, MessageUtil.menuText());
						}else if(MessageUtil.MESSAGE_VIEW.equals(eventType)){//�����View���Ͳ˵�,�ͻظ�һ�������õ�Url
							String url  = map.get("EventKey");//�����View���Ͳ˵��Ļ�,���EventKey�������Url��ֵ
							if("11".equals(url)){//���Keyֵ��11
							message = MessageUtil.initText(toUserName, fromUserName, url);
							}
						}else if(MessageUtil.MESSAGE_SCANCODE.equals(eventType)){//�ظ�һ�����ɨ���¼�
							String key  = map.get("EventKey");//�����Click���Ͳ˵��Ļ�,EventKey���������õ�Keyֵ
							message = MessageUtil.initText(toUserName, fromUserName, key);
						}
						
					}
					out .print(message);
} catch (DocumentException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}finally{
	out.close();
}

System.out.println("doPost");*/
		//response.setContentType("text/html");
		//PrintWriter out = response.getWriter();
		
/*		StringBuffer strb = new StringBuffer();
		ServletInputStream in = request.getInputStream();
          BufferedReader     breader=       new BufferedReader( new InputStreamReader(in,"UTF-8"));
		
          String str = null;
          while(null!=(str=breader.readLine())){
        	  strb.append(str);
          }
          //out.println(str);
          System.out.println(strb);*/
        //out.flush();
		//out.close();
/*response.setContentType("text/html");
PrintWriter out = response.getWriter();

StringBuffer strb = new StringBuffer();
//strb要存储一下request获取过来的东西
ServletInputStream in =  request.getInputStream();

BufferedReader breader =  new BufferedReader( new InputStreamReader(in,"UTF-8"));//接收是对的,已经进行转码了.
String str = null;
//+-*\/\是运算符,赋值运算符=也是运算符
	/*
while(null!=(str = breader.readLine())){
	 strb.append(str);
}
out.println(strb);
System.out.println(strb);
out.flush();
out.close();*/
		String requestStr = In_Util.getStringFromRequest(request);
		System.out.println(requestStr);
		System.out.println("北风网");
		In_Text text = new In_Text(requestStr);
		System.out.println(text);
	 /*    In_Image in_Image = new In_Image(requestStr);
         System.out.println(in_Image);*/
		Out_Text out_Text = new Out_Text(text,"这是北风网。。。。。。");
		
		
		
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}
package wx.in;

public class In_Image extends In{
/*	private String ToUserName =null;//	开发者微信号
	private String FromUserName	=null;//发送方帐号(一个OpenID)
	private String CreateTime =null;	//消息创建时间 (整型)
	private String MsgType=null;	//image
*/	private String PicUrl	=null;//图片链接(由系统生成)
	private String MediaId	=null;//图片消息媒体id,可以调用多媒体文件下载接口拉取数据。
	private String MsgId	=null;//消息id,64位整型
	
	public In_Image() {
		super();
		// TODO Auto-generated constructor stub
	}
	
	public In_Image(String requestStr) {
		super();
		this.setToUserName(In_Util.getStrByXML(requestStr,"ToUserName"));
		this.setFromUserName(In_Util.getStrByXML(requestStr,"FromUserName"));
		this.setCreateTime(In_Util.getStrByXML(requestStr,"CreateTime"));
		this.setMsgType(In_Util.getStrByXML(requestStr,"MsgType"));
		this.setPicUrl(In_Util.getStrByXML(requestStr,"PicUrl"));
		this.setMediaId(In_Util.getStrByXML(requestStr,"MediaId"));
		this.setMsgId(In_Util.getStrByXML(requestStr,"MsgId"));
	}

	/*public String getToUserName() {
		return ToUserName;
	}
	public void setToUserName(String toUserName) {
		ToUserName = toUserName;
	}
	public String getFromUserName() {
		return FromUserName;
	}
	public void setFromUserName(String fromUserName) {
		FromUserName = fromUserName;
	}
	public String getCreateTime() {
		return CreateTime;
	}
	public void setCreateTime(String createTime) {
		CreateTime = createTime;
	}
	public String getMsgType() {
		return MsgType;
	}
	public void setMsgType(String msgType) {
		MsgType = msgType;
	}*/
	public String getPicUrl() {
		return PicUrl;
	}
	public void setPicUrl(String picUrl) {
		PicUrl = picUrl;
	}
	public String getMediaId() {
		return MediaId;
	}
	public void setMediaId(String mediaId) {
		MediaId = mediaId;
	}
	public String getMsgId() {
		return MsgId;
	}
	public void setMsgId(String msgId) {
		MsgId = msgId;
	}

/*	@Override
	public String toString() {
		return "In_Image [ToUserName=" + ToUserName + ", FromUserName="
				+ FromUserName + ", CreateTime=" + CreateTime + ", MsgType="
				+ MsgType + ", PicUrl=" + PicUrl + ", MediaId=" + MediaId
				+ ", MsgId=" + MsgId + "]";
	}*/
	
	
	
}
package wx.in;

public class In_Link extends In{
/*	private String ToUserName=null;//	接收方微信号
	private String FromUserName	=null;//发送方微信号,若为普通用户,则是一个OpenID
	private String CreateTime	=null;//消息创建时间
	private String MsgType	=null;//消息类型,link
*/	private String Title=null;//	消息标题
	private String Description	=null;//消息描述
	private String Url	=null;//消息链接
	private String MsgId	=null;//消息id,64位整型
	
	
	
	public In_Link() {
		super();
	}
	public In_Link(String requestStr) {
		super();
		this.setToUserName(In_Util.getStrByXML(requestStr,"ToUserName"));
		this.setFromUserName(In_Util.getStrByXML(requestStr,"FromUserName"));
		this.setCreateTime(In_Util.getStrByXML(requestStr,"CreateTime"));
		this.setMsgType(In_Util.getStrByXML(requestStr,"MsgType"));
		this.setTitle(In_Util.getStrByXML(requestStr,"Title"));
		this.setDescription(In_Util.getStrByXML(requestStr,"Description"));
		this.setUrl(In_Util.getStrByXML(requestStr,"Url"));
		this.setMsgId(In_Util.getStrByXML(requestStr,"MsgId"));
	}
	/*public String getToUserName() {
		return ToUserName;
	}
	public void setToUserName(String toUserName) {
		ToUserName = toUserName;
	}
	public String getFromUserName() {
		return FromUserName;
	}
	public void setFromUserName(String fromUserName) {
		FromUserName = fromUserName;
	}
	public String getCreateTime() {
		return CreateTime;
	}
	public void setCreateTime(String createTime) {
		CreateTime = createTime;
	}
	public String getMsgType() {
		return MsgType;
	}
	public void setMsgType(String msgType) {
		MsgType = msgType;
	}*/
	public String getTitle() {
		return Title;
	}
	public void setTitle(String title) {
		Title = title;
	}
	public String getDescription() {
		return Description;
	}
	public void setDescription(String description) {
		Description = description;
	}
	public String getUrl() {
		return Url;
	}
	public void setUrl(String url) {
		Url = url;
	}
	public String getMsgId() {
		return MsgId;
	}
	public void setMsgId(String msgId) {
		MsgId = msgId;
	}
	
}
package wx.in;

public class In_Location extends In{
/*	private String  ToUserName=null;//	开发者微信号
	private String  FromUserName =null;//	发送方帐号(一个OpenID)
	private String  CreateTime =null;//	消息创建时间 (整型)
	private String  MsgType	=null;//location
*/	private String  Location_X	=null;//地理位置维度
	private String  Location_Y	=null;//地理位置经度
	private String  Scale	=null;//地图缩放大小
	private String  Label	=null;//地理位置信息
	private String  MsgId	=null;//消息id,64位整型
	
	
	
	public In_Location() {
		super();
	}
	public In_Location(String requestStr) {
		super();
		this.setToUserName(In_Util.getStrByXML(requestStr,"ToUserName"));
		this.setFromUserName(In_Util.getStrByXML(requestStr,"FromUserName"));
		this.setCreateTime(In_Util.getStrByXML(requestStr,"CreateTime"));
		this.setMsgType(In_Util.getStrByXML(requestStr,"MsgType"));
		this.setLocation_X(In_Util.getStrByXML(requestStr,"Location_X"));
		this.setLocation_Y(In_Util.getStrByXML(requestStr,"Location_Y"));
		this.setScale(In_Util.getStrByXML(requestStr,"Scale"));
		this.setLabel(In_Util.getStrByXML(requestStr,"Label"));
		this.setMsgId(In_Util.getStrByXML(requestStr,"MsgId"));
	}
	/*public String getToUserName() {
		return ToUserName;
	}
	public void setToUserName(String toUserName) {
		ToUserName = toUserName;
	}
	public String getFromUserName() {
		return FromUserName;
	}
	public void setFromUserName(String fromUserName) {
		FromUserName = fromUserName;
	}
	public String getCreateTime() {
		return CreateTime;
	}
	public void setCreateTime(String createTime) {
		CreateTime = createTime;
	}
	public String getMsgType() {
		return MsgType;
	}
	public void setMsgType(String msgType) {
		MsgType = msgType;
	}*/
	public String getLocation_X() {
		return Location_X;
	}
	public void setLocation_X(String location_X) {
		Location_X = location_X;
	}
	public String getLocation_Y() {
		return Location_Y;
	}
	public void setLocation_Y(String location_Y) {
		Location_Y = location_Y;
	}
	public String getScale() {
		return Scale;
	}
	public void setScale(String scale) {
		Scale = scale;
	}
	public String getLabel() {
		return Label;
	}
	public void setLabel(String label) {
		Label = label;
	}
	public String getMsgId() {
		return MsgId;
	}
	public void setMsgId(String msgId) {
		MsgId = msgId;
	}
	
	
}
package wx.in;
/**
 * 微信文字类型
 * @author zhongzh
 *
 */
public class In_Text extends In{


/*private String ToUserName =null;//	开发者微信号
private String FromUserName	=null;//发送方帐号(一个OpenID)
private String CreateTime =null;//	消息创建时间 (整型)
private String MsgType =null;//	text
*/private String Content =null;//	文本消息内容
private String MsgId = null;//	消息id,64位整型

public In_Text() {
	super();
	// TODO Auto-generated constructor stub
}
public In_Text(String requestStr) {
	this.setToUserName(In_Util.getStrByXML(requestStr,"ToUserName"));
	this.setFromUserName(In_Util.getStrByXML(requestStr,"FromUserName"));
	this.setCreateTime(In_Util.getStrByXML(requestStr,"CreateTime"));
	this.setMsgType(In_Util.getStrByXML(requestStr,"MsgType"));
	this.setContent(In_Util.getStrByXML(requestStr,"Content"));
	this.setMsgId(In_Util.getStrByXML(requestStr,"MsgId"));
	
}
/*public String getToUserName() {
	return ToUserName;
}
public void setToUserName(String toUserName) {
	ToUserName = toUserName;
}
public String getFromUserName() {
	return FromUserName;
}
public void setFromUserName(String fromUserName) {
	FromUserName = fromUserName;
}
public String getCreateTime() {
	return CreateTime;
}
public void setCreateTime(String createTime) {
	CreateTime = createTime;
}
public String getMsgType() {
	return MsgType;
}
public void setMsgType(String msgType) {
	MsgType = msgType;
}*/
public String getContent() {
	return Content;
}
public void setContent(String content) {
	Content = content;
}
public String getMsgId() {
	return MsgId;
}
public void setMsgId(String msgId) {
	MsgId = msgId;
}
/*@Override
public String toString() {
	return "In_Text [ToUserName=" + ToUserName + ", FromUserName="
			+ FromUserName + ", CreateTime=" + CreateTime + ", MsgType="
			+ MsgType + ", Content=" + Content + ", MsgId=" + MsgId + "]";
}*/

}
package wx.in;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;

public class In_Util {
   
    /**
     * 通过request得到请求流中的微信报文str
     * @param request
     * @return
     */

	 
	 
       
	public static String getStringFromRequest(HttpServletRequest request){
		StringBuffer strb = new StringBuffer();
		//strb要存储一下request获取过来的东西
		ServletInputStream in;
		try {
			in = request.getInputStream();
	

		BufferedReader breader =  new BufferedReader( new InputStreamReader(in,"UTF-8"));//接收是对的,已经进行转码了.
		String str = null;
		//+-*/是运算符,赋值运算符=也是运算符
		while(null!=(str = breader.readLine())){
			 strb.append(str);
		}
	}
	 catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return strb.toString();
	}
	/**
	 * 得到微信的相关文字
	 * @param str
	 * @return
	 */
	public static String getStrByXML(String str,String tagName){
		//解析XML,使用dom4j或者是SAX,JDOM这类框架.
		//使用最基本的字符串处理它
		//可以使用解析XML的第三方框架或者是工具包,dom4j之类的.
		String begin = "<"+tagName+"><![CDATA[";
		String end = "]]></"+tagName+">";
		boolean flag = false;
		if("CreateTime".equals(tagName)){
			flag = true;
		}else if("MsgId".equals(tagName)){
			flag = true;
		}else if("Location_X".equals(tagName)){
			flag = true;
		}else if("Location_Y".equals(tagName)){
			flag = true;
		}else if("Scale".equals(tagName)){
			flag = true;
		}
		if(flag ){
			 begin = "<"+tagName+">";
			 end = "</"+tagName+">";
		}
		System.out.println(begin);
		System.out.println(end);
		int beginIndex = str.indexOf(begin) + begin.length();//
		int endIndex = str.indexOf(end);
		
		return str.substring(beginIndex,endIndex);
		
	}
}
package wx.in;

public class In_Video extends In{
/*	private String ToUserName =null;//	开发者微信号
	private String FromUserName =null;//	发送方帐号(一个OpenID)
	private String CreateTime =null;//	消息创建时间 (整型)
	private String MsgType =null;//	视频为video
*/	private String MediaId =null;;//	视频消息媒体id,可以调用多媒体文件下载接口拉取数据。
	private String ThumbMediaId	=null;//视频消息缩略图的媒体id,可以调用多媒体文件下载接口拉取数据。
	private String MsgId	=null;//消息id,64位整型
	
	
	
	public In_Video() {
		super();
	}
	public In_Video(String requestStr) {
		super();
		this.setToUserName(In_Util.getStrByXML(requestStr,"ToUserName"));
		this.setFromUserName(In_Util.getStrByXML(requestStr,"FromUserName"));
		this.setCreateTime(In_Util.getStrByXML(requestStr,"CreateTime"));
		this.setMsgType(In_Util.getStrByXML(requestStr,"MsgType"));
		this.setMediaId(In_Util.getStrByXML(requestStr,"MediaId"));
		this.setThumbMediaId(In_Util.getStrByXML(requestStr,"ThumbMediaId"));
		this.setMsgId(In_Util.getStrByXML(requestStr,"MsgId"));
	}
	/*public String getToUserName() {
		return ToUserName;
	}
	public void setToUserName(String toUserName) {
		ToUserName = toUserName;
	}
	public String getFromUserName() {
		return FromUserName;
	}
	public void setFromUserName(String fromUserName) {
		FromUserName = fromUserName;
	}
	public String getCreateTime() {
		return CreateTime;
	}
	public void setCreateTime(String createTime) {
		CreateTime = createTime;
	}
	public String getMsgType() {
		return MsgType;
	}
	public void setMsgType(String msgType) {
		MsgType = msgType;
	}*/
	public String getMediaId() {
		return MediaId;
	}
	public void setMediaId(String mediaId) {
		MediaId = mediaId;
	}
	public String getThumbMediaId() {
		return ThumbMediaId;
	}
	public void setThumbMediaId(String thumbMediaId) {
		ThumbMediaId = thumbMediaId;
	}
	public String getMsgId() {
		return MsgId;
	}
	public void setMsgId(String msgId) {
		MsgId = msgId;
	}
	
}
package wx.in;

public class In_Voice extends In{
/*	private String ToUserName =null;//	开发者微信号
	private String FromUserName =null;//	发送方帐号(一个OpenID)
	private String CreateTime=null;//	消息创建时间 (整型)
	private String MsgType=null;//	语音为voice
*/	private String MediaId	=null;//语音消息媒体id,可以调用多媒体文件下载接口拉取数据。
	private String Format	=null;//语音格式,如amr,speex等
	private String MsgId	=null;//消息id,64位整型
	
	
	
	
	
	public In_Voice() {
		super();
	}
	public In_Voice(String requestStr) {
		super();
		this.setToUserName(In_Util.getStrByXML(requestStr,"ToUserName"));
		this.setFromUserName(In_Util.getStrByXML(requestStr,"FromUserName"));
		this.setCreateTime(In_Util.getStrByXML(requestStr,"CreateTime"));
		this.setMsgType(In_Util.getStrByXML(requestStr,"MsgType"));
		this.setMediaId(In_Util.getStrByXML(requestStr,"MediaId"));
		this.setFormat(In_Util.getStrByXML(requestStr,"Format"));
		this.setMsgId(In_Util.getStrByXML(requestStr,"MsgId"));
	}
	/*public String getToUserName() {
		return ToUserName;
	}
	public void setToUserName(String toUserName) {
		ToUserName = toUserName;
	}
	public String getFromUserName() {
		return FromUserName;
	}
	public void setFromUserName(String fromUserName) {
		FromUserName = fromUserName;
	}
	public String getCreateTime() {
		return CreateTime;
	}
	public void setCreateTime(String createTime) {
		CreateTime = createTime;
	}
	public String getMsgType() {
		return MsgType;
	}
	public void setMsgType(String msgType) {
		MsgType = msgType;
	}*/
	public String getMediaId() {
		return MediaId;
	}
	public void setMediaId(String mediaId) {
		MediaId = mediaId;
	}
	public String getFormat() {
		return Format;
	}
	public void setFormat(String format) {
		Format = format;
	}
	public String getMsgId() {
		return MsgId;
	}
	public void setMsgId(String msgId) {
		MsgId = msgId;
	}
	
}
package wx.in;

public class In {

	private String ToUserName = null;//开发者微信号
	private String FromUserName = null;// 发送方账号(一个OpenID)
	private String CreateTime = null;// 消息创建时间(整型)
	private String MsgType = null;//  text
	public String getToUserName() {
		return ToUserName;
	}
	public void setToUserName(String toUserName) {
		ToUserName = toUserName;
	}
	public String getFromUserName() {
		return FromUserName;
	}
	public void setFromUserName(String fromUserName) {
		FromUserName = fromUserName;
	}
	public String getCreateTime() {
		return CreateTime;
	}
	public void setCreateTime(String createTime) {
		CreateTime = createTime;
	}
	public String getMsgType() {
		return MsgType;
	}
	public void setMsgType(String msgType) {
		MsgType = msgType;
	}
	public In() {
		super();
		// TODO Auto-generated constructor stub
	}
	public In(String requestStr) {
		this.setToUserName(In_Util.getStrByXML(requestStr, "ToUserName"));
		this.setFromUserName(In_Util.getStrByXML(requestStr, "FromUserName"));
		this.setCreateTime(In_Util.getStrByXML(requestStr, "CreateTime"));
		this.setMsgType(In_Util.getStrByXML(requestStr, "MsgType"));
		
	}
	@Override
	public String toString() {
		return "In [ToUserName=" + ToUserName + ", FromUserName="
				+ FromUserName + ", CreateTime=" + CreateTime + ", MsgType="
				+ MsgType + "]";
	}
	
 
}

 

© 著作权归作者所有

blueheart
粉丝 0
博文 35
码字总数 29716
作品 0
佛山
程序员
私信 提问
分享java微信开发视频

课程讲师:翟东平 课程分类:Java适合人群:高级课时数量:24(41节)课时更新程度:完毕服务类型:C类(普通服务类课程)用到技术:微信公众平台,微信,java涉及项目:超市促销活动,微信限时...

双层牛堡
2015/04/07
0
0
Java微信开发_00_资源汇总贴

1.微信公众平台技术文档(https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1445241432) 2.微信企业号开发接口文档(http://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%BB%E......

rayner
2017/08/07
0
0
微信公众帐号开发教程第4篇-消息及消息处理工具的封装

工欲善其事必先利其器!本篇内容主要讲解如何将微信公众平台定义的消息及消息相关的操作封装成工具类,方面后期的使用。这里需要明确的是消息其实是由用户发给你的公众帐号的,消息先被微信平...

bliver
2013/11/29
0
2
JeeWx 捷微 2.3 发布,JAVA微信管家平台

JeeWx,敏捷微信开发,简称“捷微”,捷微是一款免费开源的JAVA微信管家平台 一、简介 Jeewx是一个开源、高效、敏捷的微信开发平台,采用JAVA语言基于Jeecg快速开发框架实现,Jeewx开源版实现...

Jeecg
2016/03/24
10.6K
0
微信公众平台开发教程新手解惑40则

【编者按】由CSDN和《程序员》杂志联合主办的 2014年微信开发者大会 将于8月23日在北京举行,邀请了来自于一线的微信开发商技术负责人或资深工程师从企业应用开发高级篇、智能客服与LBS、微信...

DavidBao
2015/04/29
0
0

没有更多内容

加载失败,请刷新页面

加载更多

怎么选择数据服务器?请记住这五条

我们应当都知道“数据无价”这个词,既然数据那么主要,选择一款安全稳定的数据服务器是很有必要的,那么如何选择一款牢靠的,稳定的数据服务器呢?我们从五个方面下手,协助您体系的了解数据...

linux-tao
6分钟前
0
0
第一讲:编写TCP Socket小程序

根据下面的步骤编写TCP Socket小程序。注意:作者必须是自己的名字。结果如下: 步骤: 1、用VC建立服务器程序 创建一个win32控制台程序 上面的代码如下,编写代码的时候切换到FileView界面,...

一匹狼工作室
8分钟前
0
0
python-protobuf2uml

首先这篇文章是参考的https://github.com/vak/protobuf2uml 本篇文章都是基于python3的 下面首先我们说一下python3的安装 wget https://github.com/protocolbuffers/protobuf/releases/down...

yiduwangkai
9分钟前
0
0
mysql通过source恢复大表小计

最近迁移一个数据库,500多张表大概600多万条数据,通过navicat导出的数据,再通过source命令导入到mysql8.0 之前也做过类似的工作,但是却从来没有这么慢过,一个小时了还没有完成,之前在笔...

休辞醉倒
10分钟前
0
0
Java、Python、C++、PHP、JavaScript这5大编程语言,我究竟该选哪个?

很多朋友在后台给我留言,问:现在这么多编程语言,Python、Java、PHP、C++、JavaScript等,究竟哪种最流行?我想这应该也是你的困扰吧! 其实他们各有优势,但是对于选择困难的程序员而言,...

Java领航员
26分钟前
0
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部