Exemplo n.º 1
0
 public static String initText(String toUserName, String fromUserName, String content) {
   System.out.println("here");
   TextMessage textMessage = new TextMessage();
   textMessage.setFromUserName(toUserName);
   textMessage.setToUserName(fromUserName);
   textMessage.setMsgType(MessageUtil.REQ_MESSAGE_TYPE_TEXT);
   textMessage.setCreateTime(new Date().getTime());
   textMessage.setContent("您发送的消息是:" + content);
   return textMessageToXml(textMessage);
 }
Exemplo n.º 2
0
 /**
  * 文本消息对象转换成xml
  *
  * @param textMessage
  * @return
  */
 public static String textMessageToXml(TextMessage textMessage) {
   xstream.alias("xml", textMessage.getClass());
   return xstream.toXML(textMessage);
 }