private String generateXml(String encrypt, String signature, String timestamp, String nonce) {
    String format =
        "<xml>\n"
            + "<Encrypt><![CDATA[%1$s]]></Encrypt>\n"
            + "<MsgSignature><![CDATA[%2$s]]></MsgSignature>\n"
            + "<TimeStamp>%3$s</TimeStamp>\n"
            + "<Nonce><![CDATA[%4$s]]></Nonce>\n"
            + "</xml>";
    return String.format(format, encrypt, signature, timestamp, nonce);
  }
private String generateXml ( String encrypt , String signature , String timestamp , String nonce ) { String format = "<xml>\n" + "<Encrypt><![CDATA[%1$s]]></Encrypt>\n" + "<MsgSignature><![CDATA[%2$s]]></MsgSignature>\n" + "<TimeStamp>%3$s</TimeStamp>\n" + "<Nonce><![CDATA[%4$s]]></Nonce>\n" + "</xml>" ; return String . format ( format , encrypt , signature , timestamp , nonce ) ; }
生成xml消息

@param encrypt   加密后的消息密文
@param signature 安全签名
@param timestamp 时间戳
@param nonce     随机字符串
@return 生成的xml字符串