package mms.wellsoon.com;
import com.ericsson.services.mms.sdk.vasp.api.*;
import java.io.*;import java.util.*;
import java.net.*;
import java.awt.*;
/**
* Sample Application using the Ericsson VASP MMS SDK.
* @author RL
* @version 1
*/
public class mm7send { /** Creates new testapp object this is a main app.
*/ //* Default URL's for the MMC and the Delivery/Read Report location.
static final String MMCAddress = "http://192.168.9.133:8080/vasp/servlet/messagerouter";
static final String ReportAddress = "http://192.168.9.133:8080/vasp/servlet/messagerouter";
public mm7send( ) {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
} } static URL MakeURL(String s) {
URL MMCUrl = null;
try {
MMCUrl = new URL(s);
}
catch (MalformedURLException e) {
System.err.println("URL Problem : " + e.toString());
System.exit(-1);
}
return MMCUrl;
} /** A test application for submitting a MultiMedia Message
* to the MMC relay server
* @param args the command line arguments
*/
public int send ( String toNum,String linkAddr) { /*
* Create Multi Media Message
*/
MultiMediaMessage msg = new MultiMediaMessage(); msg.setAllowAdaptations(true);
msg.setAllowCancel(true);
msg.setAllowReverseCharging(false);
msg.setAllowSenderVisibility(true);
msg.setDeliveryReport(true);
msg.setReadReport(true);
msg.addDestinationTO("+"+toNum);
//msg.addDestinationTO("+"+"13345678912");
//msg.addDestinationTO("+"+"13123456789");
//msg.addDestinationTO("+15166771001"); //接收方
//msg.addDestinationCC("+15166772000");?//抄送方
//msg.addDestinationCC("+15166772001");?//抄送方
//msg.addDestinationBCC("+15166773000"); //密送方
//msg.addDestinationBCC("+15166773001"); //密送方
msg.setRelativeTimeofExpiry(24*60*60); //* Expire in one day
msg.setPriority( MultiMediaMessage.normalPriority );
msg.setMessageClass( MultiMediaMessage.advertisementClass );
msg.setReportAddress( ReportAddress ); // Where to send reports to ..
// msg.setEarliestDeliveryTime(new Date());
msg.setFrom("123456");
msg.setSubject("Check this out ---"); msg.addAttachment(new File("E:\\project\\mms1\\wellsoonmms\\mms\\"+linkAddr.substring(3))); /*
* Create an identification of the application
*/
MultiMediaApplication mycon = new MultiMediaApplication(); mycon.setUserName("Ron Lissack");
mycon.setPassword("Hush-Hush");
mycon.setApplicationName("CoolPix4Money");
mycon.setApplicationProviderName("MyCompany");
/*
* Create a MMC context
*/
MultiMediaController msub = new MultiMediaController(); /*
* Submit the message to the MMC and process the response
*/
MultiMediaSubmitResponse rsp = null;
URL mmcURL = MakeURL(MMCAddress);
try {
rsp = msub.SubmitMsg( mmcURL ,mycon,msg);
}
catch (Exception ee) {
System.out.println("Failure == " + ee.toString());
System.exit(1);
} /*
* Was the submission Succesfull ?
**/
if (rsp.isSuccess()) {
System.out.println("MMC Got Message ID = " + rsp.getMessageID());
return 1;
}
else {
System.out.println("Error Encountered During Submission [" +
rsp.getSubmitResultCode() + "] " +
rsp.getSubmitResultDescription());
return 0;
}
}
private void jbInit() throws Exception {
}}
import com.ericsson.services.mms.sdk.vasp.api.*;
import java.io.*;import java.util.*;
import java.net.*;
import java.awt.*;
/**
* Sample Application using the Ericsson VASP MMS SDK.
* @author RL
* @version 1
*/
public class mm7send { /** Creates new testapp object this is a main app.
*/ //* Default URL's for the MMC and the Delivery/Read Report location.
static final String MMCAddress = "http://192.168.9.133:8080/vasp/servlet/messagerouter";
static final String ReportAddress = "http://192.168.9.133:8080/vasp/servlet/messagerouter";
public mm7send( ) {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
} } static URL MakeURL(String s) {
URL MMCUrl = null;
try {
MMCUrl = new URL(s);
}
catch (MalformedURLException e) {
System.err.println("URL Problem : " + e.toString());
System.exit(-1);
}
return MMCUrl;
} /** A test application for submitting a MultiMedia Message
* to the MMC relay server
* @param args the command line arguments
*/
public int send ( String toNum,String linkAddr) { /*
* Create Multi Media Message
*/
MultiMediaMessage msg = new MultiMediaMessage(); msg.setAllowAdaptations(true);
msg.setAllowCancel(true);
msg.setAllowReverseCharging(false);
msg.setAllowSenderVisibility(true);
msg.setDeliveryReport(true);
msg.setReadReport(true);
msg.addDestinationTO("+"+toNum);
//msg.addDestinationTO("+"+"13345678912");
//msg.addDestinationTO("+"+"13123456789");
//msg.addDestinationTO("+15166771001"); //接收方
//msg.addDestinationCC("+15166772000");?//抄送方
//msg.addDestinationCC("+15166772001");?//抄送方
//msg.addDestinationBCC("+15166773000"); //密送方
//msg.addDestinationBCC("+15166773001"); //密送方
msg.setRelativeTimeofExpiry(24*60*60); //* Expire in one day
msg.setPriority( MultiMediaMessage.normalPriority );
msg.setMessageClass( MultiMediaMessage.advertisementClass );
msg.setReportAddress( ReportAddress ); // Where to send reports to ..
// msg.setEarliestDeliveryTime(new Date());
msg.setFrom("123456");
msg.setSubject("Check this out ---"); msg.addAttachment(new File("E:\\project\\mms1\\wellsoonmms\\mms\\"+linkAddr.substring(3))); /*
* Create an identification of the application
*/
MultiMediaApplication mycon = new MultiMediaApplication(); mycon.setUserName("Ron Lissack");
mycon.setPassword("Hush-Hush");
mycon.setApplicationName("CoolPix4Money");
mycon.setApplicationProviderName("MyCompany");
/*
* Create a MMC context
*/
MultiMediaController msub = new MultiMediaController(); /*
* Submit the message to the MMC and process the response
*/
MultiMediaSubmitResponse rsp = null;
URL mmcURL = MakeURL(MMCAddress);
try {
rsp = msub.SubmitMsg( mmcURL ,mycon,msg);
}
catch (Exception ee) {
System.out.println("Failure == " + ee.toString());
System.exit(1);
} /*
* Was the submission Succesfull ?
**/
if (rsp.isSuccess()) {
System.out.println("MMC Got Message ID = " + rsp.getMessageID());
return 1;
}
else {
System.out.println("Error Encountered During Submission [" +
rsp.getSubmitResultCode() + "] " +
rsp.getSubmitResultDescription());
return 0;
}
}
private void jbInit() throws Exception {
}}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货