Java MMS Library
By admin on Nov 6, 2009 in Java
I just release the Java MMS library. It is a library that can be used to encode or decode MMS message. The encoded MMS can then be sent out using MM1 or MM7 protocol. To use MM1 protocol, you need a GPRS/3G modem or GPRS/3G phone. For MM7, you need a connection to MMSC.
A simple sample is provided to show how to use it together with jWAP to send out MMS using MM1 protocol.
1: WAPClient wapClient = new WAPClient(wapGatewayHost, wapGatewayPort);
2: PostRequest request = new PostRequest(servlet);
3: request.setContentType("application/vnd.wap.mms-message");
4: request.setRequestBody(encodedMms);
5:
6: System.out.println("Connecting to \"" + wapGatewayHost + "\":" + wapGatewayPort + "...");
7: wapClient.connect();
8:
9: System.out.println("Sending mms message through \"" + servlet + "\"...");
10: Response response = wapClient.execute(request);
11: byte[] binaryMms = response.getResponseBody();
12: wapClient.disconnect();
13: try {
14: MultimediaMessageDecoder dec = new MultimediaMessageDecoder(binaryMms);
15: dec.decodeMessage();
16: MultimediaMessage message = dec.getMessage();
17:
18: System.out.println("Status: " + response.getStatus());
19: System.out.println("Status Text: " + response.getStatusText());
20:
21: if (response.getStatus() == 200) {
22: System.out.println("Message id: " + message.getMessageId());
23: System.out.println("Message sent!");
24: } else {
25: System.out.println("Message is not sent");
26: }
27:
28: } catch (Exception e) {
29: System.out.println(e.getMessage());
30: }
Popularity: 2% [?]
M. Eir | Sep 30, 2010 | Reply
Hi,
I’m having trouble submitting an application/vnd.wap.mms-message MMS to an MMSC using MM7. Is there any special way to encode the message as a MIME or something?
The MMSC accepts the message, but no media displays on my handset.