How to generate .MMS file through Java program

How to generate .MMS file through Java program SearchSearch
Author Message
Anonymous
 
Posted on Thursday, September 23, 2004 - 05:53 am:   

Hi guys,
Is it possible to generate .MMS file through Java Program or any other Java API? I have contacted mmssdk.com and they informed me that its not compatible with Java.
any inputs on how to generate .MMS file will be helpful?
thanks,
Mark
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 3443
Registered: 10-2002
Posted on Friday, September 24, 2004 - 06:16 pm:   

Mark,

The first question that arises is ... do you really need to generate a ".MMS file"?

The reason I say this is because depending on how you need to ultimately send the message, you may be no closer to sending the message in that format. (That format is only used with the MM1 interface, and is not used with other interfaces like MM4 and MM7.)

Someone was kind enough to provide an example of how to send an MMS message via NowSMS via Java at the following link:

http://support.nowsms.com/discus/messages/485/1360.html

Some explanation about the above ... basically the Java code is emulating the "Send MMS Message" form. Basically, when you submit a web form that includes a file upload component, the standard is to post the form using the MIME type of "multipart/form-data".

I don't think any of the standard Java classes provide any aid in formatting this type of HTTP request.

Some people get confused about the fact that the example referenced above uses the Apache HttpClient library.

It doesn't require that you are using the Apache web server ... it is a separate Apache project, where basically you can download the classes and add them to your Java install.

The Apache HttpClient has built-in support for building HTTP requests using the "multpart/form-data" MIME type.

Here are the relevant links:

http://jakarta.apache.org/commons/httpclient/index.html
http://jakarta.apache.org/commons/httpclient/downloads.html
http://jakarta.apache.org/commons/httpclient/tutorial.html
Anonymous
 
Posted on Monday, September 27, 2004 - 02:50 am:   

Hi Bryce,
thanks for replying. Well let me explain my problem again.Im working on a project which will pick up all the parameters from DB for the following functionalities:
1) Sending MMS,
2) Sending WAP Push,
3) Sending WAP OTA Settings.
Well, now my sample program does all the 3 things assuming that .MMS file exists on the server.But my Project requires that I pick up all the .gif,.jpeg,midi files etc from our server. Hence,Im guessing that we have to generate .MMS file programatically.
I am already using HttpClient API to upload existing sample MMS files on NowSMS server and can do all the 3 functionalities assuming that .MMS file already exists. SO no worries.
hope ur getting my problem...;)
My main worry is that i have to generate .MMS file automatically as everything is database driven.

1)the reason I say this is because depending on how you need to ultimately send the message, you may be no closer to sending the message in that format. (That format is only used with the MM1 interface, and is not used with other interfaces like MM4 and MM7.)
Ans : Does that mean that there is no way i can generate .MMS file on the fly? and even if i do it would be no close to the required format ex MM1 protocol?
I did some research and found out that i can execute Nokias Developer Suite for MMS API eternally and generate .MMS file But when i tried to upload the generated .MMS file, it doesnt seem to work.(I have yet to try in through NowSMS Web-Interface)
Please let me know ur thoughts.
thanks for replying to my post..
mark
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 3461
Registered: 10-2002
Posted on Monday, September 27, 2004 - 10:46 pm:   

Mark,

Based upon your description, I don't think there's a requirement for generating an MMS file.

Ah ... I see the confusion. That HttpClient example is uploading a pre-compiled MMS file.

From the example:

File filMMSFile = new File("D:/Pelemedia/Development/MMS/test.MMS");
FilePart prtMMSFile = new FilePart("MMSFile",filMMSFile,"application/vnd.wap.multipart.related","iso-8859- 1");

method.addPart(prtMMSFile);

But, using that interface into NowSMS, it's not a requirement that you do have things pre-compiled into an MMS file. So you would just repeat this sequence, and add multiple file parts ... repeating for each GIF, JPEG, text part, SMIL, etc.

Note that NowSMS is going to determine the content type based upon the file extension, not the MIME type included in this particular call. (Technically, the MIME type included in the example is not correct for an MMS file, but we are treating it as such because of the ".mms" extension.)

Does that simplify things for you?

If you still need to create a compiled MMS file, try our MMSCOMP command line utility.

The Nokia libs should also work. Try posting one of those files through the web menu interface just to make sure that there is no difference between your posting it that way vs. posting it through your program code. Feel free to upload the ".mms" file as an attachment here, and I can also take a closer look at it.
Anonymous
 
Posted on Thursday, September 30, 2004 - 08:21 am:   

Hi Bruce,
thanks for ur reply. Repeating the sequence for different file types sounds good. i will certainly look at that option and will let u know.
Can u tell me whats the correct MIME type i should set so that i works for all MMS capable Phones?
thanks,
Sachin

Anonymous
 
Posted on Thursday, September 30, 2004 - 10:22 am:   

Here is the .MMS file
application/vnd.wap.mms-messageMMS file
ya.mms (5.9 k)
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 3539
Registered: 10-2002
Posted on Thursday, September 30, 2004 - 08:09 pm:   

Hi Sachin,

The correct MIME type wuold be "application/vnd.wap.mms-message". When you submit through this interface, NowSMS is always going to trigger off of the file extension rather than the MIME type, using the table in MMSCTYPE.INI to match up types (or if not in that table, referring to the Windows registry on the PC running NowSMS).

I'm taking a closer look at the mms file ...
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 3540
Registered: 10-2002
Posted on Thursday, September 30, 2004 - 08:45 pm:   

What issues are you having sending that MMS file?

I was able to send it just fine ... the only issue is that the MIDI. I believe that is because the phone I tried it on does not support audio/sp-midi as one of its content types.
Anonymous
 
Posted on Monday, December 27, 2004 - 02:28 am:   

Hi, I am also trying to create a MMS message from a PC application (.NET C#)using NowSMS as the gateway. If I have written the code for the encoding, is there anyway I can use the gateway to push to a telco without going through the web interface?
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 3807
Registered: 10-2002
Posted on Thursday, December 30, 2004 - 05:49 pm:   

You could send it via SMTP, but HTTP is easier.

Assuming that you have the "To:" header included in the encoded MMS message, just do this:

POST /username=password HTTP/1.0
Content-type: application/vnd.wap.mms-message
Content-Length: ####

Raw MMS file here

You need to substitute in the length of the MMS file for the #### above.

Also, your URL may vary. In the above example, I am posting it through a user account definition defined under "MMSC Users". If you want to post it through a VASP account defined to NowSMS, modify the POST URL to be /mm1/account=password.

Also, note that you can use the EAIF interface, which is MM1 based, but allows you to override the recipient list.

POST /eaif/account=password HTTP/1.0
Content-type: application/vnd.wap.mms-message
Content-Length: ####
X-Nokia-MMSC-To: recipient1
X-Nokia-MMSC-To: recipient2
X-Nokia-MMSC-To: recipient3

Raw MMS file here


-bn
Tanvir
Unregistered guest
Posted on Wednesday, May 11, 2005 - 09:54 am:   

hi,
my name is tanvir ali, currentrly i m studying,
I want to send sms and mms from my PC to any mobile using java.
Anyone who knows about this Please help me!!!
popeye
Unregistered guest
Posted on Thursday, May 12, 2005 - 08:08 am:   

How can i send SMS or MMS from C#.Net using Nowsms as the gateway? Is there any a sample code i can use as reference?
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 4521
Registered: 10-2002
Posted on Monday, May 16, 2005 - 10:49 pm:   

Sorry, I don't have any C# examples ... but basically what you are doing is performing an HTTP GET or an HTTP POST.

So any sample code that performs an HTTP GET or POST could be easily adapted.

The following link gives the HTTP GET format for sending an SMS:

http://www.nowsms.com/documentation/ProductDocumentation/sending_messages/sendin g_text_messages.htm

With additional parameters described here:

http://www.nowsms.com/documentation/ProductDocumentation/sending_messages/url_pa rameters_for_sending_messages.htm

An HTTP POST example of sending an MMS is given in the following link:

http://www.nowsms.com/documentation/ProductDocumentation/mms_notifications_and_c ontent/Submitting_MMS_Messages_URL.htm

There is also an example in that link of using a simple HTTP GET to send an MMS, which is possible only when your MMS content objects are accessible via an existing web server.

-bn