该提交了:
MM7RSRes res = mm7Sender.send(submitReq);
最后又个返回,
package com.cmcc.mm7.vasp.conf;
import com.cmcc.mm7.vasp.message.*;
import com.cmcc.mm7.vasp.service.MM7Sender;
import com.cmcc.mm7.vasp.common.*;
import java.io.*;
public class VaspSendTest {
public static void main(String[] args) {
MM7Config mm7Config = new MM7Config("./config/mm7Config.xml"); 上文提到的配置文件
mm7Config. setConnConfigName("./config/ConnConfig.xml");
MM7Sender mm7Sender = new MM7Sender(mm7Config); 用来提交的类,
MM7SubmitReq submit = new MM7SubmitReq(); 发送的请求
submit.setTransactionID("11111111");
submit.addTo("13915002000"); 目的号码
submit.setVASID("1234"); 固定的吧
submit.setServiceCode("123"); 业务类型
submit.setSubject("测试"); 彩信标题
MMContent content = new MMContent(); 彩信内容
content.setContentType(MMConstants.ContentType. MULTIPART_MIXED);
MMContent sub1 = MMContent.createFromFile("f://yellow.gif");
sub1.setContentID("1.gif");
sub1.setContentType(MMConstants.ContentType.GIF);
content.addSubContent(sub1);
MMContent sub2 = MMContent.createFromString("This is a Test2!");
sub2.setContentID("2.txt");
sub2.setContentType(MMConstants.ContentType. TEXT);
content.addSubContent(sub2);
submit.setContent(content);
MM7RSRes res = mm7Sender.send(submit); 发送
System.out.println("res.mso-spacerun: yes"> ";res.statusText=" + res.getStatusText());
}
}
MM7 API (5)
最新推荐文章于 2019-07-13 16:03:59 发布