首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2ME开发 >

关于Nokia MMS Library 包包 发彩信的有关问题,请大侠们拔刀相助

2012-12-16 
关于Nokia MMS Library 包包 发彩信的问题,急,请大侠们拔刀相助我用Nokia MMS Library发送彩信,完全是按sa

关于Nokia MMS Library 包包 发彩信的问题,急,请大侠们拔刀相助
我用Nokia MMS Library发送彩信,完全是按sample文件夹下面的OriginatingApp的例子运行的,但是  总是在MMSender中的
connection.getResponseCode()处报错,
win7 系统 报的是 
Software caused connection abort: recv failed
        at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:147)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1064)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
at com.nokia.mms.MMSender.send(MMSender.java:172)
at com.nokia.mms.MMSender.send(MMSender.java:99)
at com.emay.nokia.send.OriginatingApp.<init>(OriginatingApp.java:30)
at com.emay.nokia.send.OriginatingApp.main(OriginatingApp.java:141)
Connection reset  xp系统报的是 
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1064)Connection reset

at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
at com.nokia.mms.MMSender.send(MMSender.java:172)
at com.nokia.mms.MMSender.send(MMSender.java:99)
at com.emay.nokia.send.OriginatingApp.<init>(OriginatingApp.java:26)
at com.emay.nokia.send.OriginatingApp.main(OriginatingApp.java:138)

我将xp和win7的防火墙也全部关闭了,telnet 10.0.0.172 80 也是没问题的,nokia的包换了两个了,都不好使,求助一下大家这个东东是怎么造成的。

构造方法:


public OriginatingApp() {
MMMessage mm = new MMMessage();
SetMessage(mm);
AddContents(mm);

MMEncoder encoder = new MMEncoder();
encoder.setMessage(mm);

try {
encoder.encodeMessage();
byte[] out = encoder.getMessage();
for (int i = 0; i < out.length; i++) {
System.out.print(out[i]+" ");
}


MMSender sender = new MMSender();
sender.setMMSCURL("http://mmsc.monternet.com");

sender.addHeader("X-NOKIA-MMSC-Charging", "100");

MMResponse mmResponse = sender.send(out);
System.out.println("Message sent to " + sender.getMMSCURL());
System.out.println("Response code: " + mmResponse.getResponseCode()
+ " " + mmResponse.getResponseMessage());

Enumeration keys = mmResponse.getHeadersList();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
String value = (String) mmResponse.getHeaderValue(key);


System.out.println(key + ": " + value);
}

} catch (Exception e) {
System.out.println(e.getMessage());
}
}


设置message处的代码:

private void SetMessage(MMMessage mm) {
mm.setVersion(IMMConstants.MMS_VERSION_10);
mm.setMessageType(IMMConstants.MESSAGE_TYPE_M_SEND_REQ);
mm.setTransactionId("0000000066");
mm.setDate(new Date(System.currentTimeMillis()));
// mm.setFrom("+358990000066/TYPE=PLMN");
mm.addToAddress("+8615210009047/TYPE=PLMN");
// mm.addToAddress("123.124.125.125/TYPE=IPv4");
// mm.addToAddress("1234:5678:90AB:CDEF:FEDC:BA09:8765:4321/TYPE=IPv6");
// mm.addToAddress("john.doe@nokia.com");
mm.setDeliveryReport(true);
mm.setReadReply(false);
mm.setSenderVisibility(IMMConstants.SENDER_VISIBILITY_SHOW);
mm.setSubject("测试标题字符串");
mm.setMessageClass(IMMConstants.MESSAGE_CLASS_PERSONAL);
mm.setPriority(IMMConstants.PRIORITY_LOW);
mm.setContentType(IMMConstants.CT_APPLICATION_MULTIPART_MIXED);
// In case of multipart related message and a smil presentation
// available
// mm.setContentType(IMMConstants.CT_APPLICATION_MULTIPART_RELATED);
// mm.setMultipartRelatedType(IMMConstants.CT_APPLICATION_SMIL);
// mm.setPresentationId("<A0>"); // where <A0> is the id of the content
// containing the SMIL presentation
}

执行代码:

public static void main(String[] args) {
String strProxy = "10.0.0.172";
String strPort = "80";
Properties systemProperties = System.getProperties();
systemProperties.setProperty("http.proxyHost", strProxy);
systemProperties.setProperty("http.proxyPort", strPort);
OriginatingApp oa = new OriginatingApp();
}

[解决办法]
已经解决,居然6天没一个人回复。。。

热点排行