Experts in SMS and MMS Technology. NCLs Provato is an SMS/MMS Gateway supporting  WAP Push, EMS, MMS, SMS, Nokia Smart Messaging, SMPP, CIMD, UCP, MM7, M20, TC35 NCL Technologies Ltd
Provato - SMS MMS Gateway
Mobile Messaging in J2EE & .NET

SwiftNote - Java SMS Toolkit

ie.ncl.mms
Class MMSMessage

java.lang.Object
  extended by ie.ncl.msg.Message
      extended by ie.ncl.mms.MMSMessage
All Implemented Interfaces:
java.io.Serializable

public class MMSMessage
extends Message

This is used to constuct an MMS message that can be sent to an SMS, EMS, Smart Message and MMS handset.

In the case where a MMS Message is sent as a smart message or an EMS message, the following SMS attributes are set:

   ie.ncl.sms.MessageAttributeNames.PID
   ie.ncl.sms.MessageAttributeNames.VALIDITY
   ie.ncl.sms.MessageAttributeNames.REPLACE
   ie.ncl.sms.MessageAttributeNames.PRIORITY
   ie.ncl.sms.MessageAttributeNames.SCA
   ie.ncl.sms.MessageAttributeNames.SCHEDULE
   ie.ncl.sms.MessageAttributeNames.DCS
   ie.ncl.sms.MessageAttributeNames.REGISTERED

If the message is fragmented and transmitted over SMS then the Message ID is that of the last SMS fragment transmitted.

If a delivery receipt is requested (see REGISTERED) then it is only requested for the last message fragment only, and as such the delivery receipt ID will be the same as the sent message's ID.

In some cases a different DCS may be used by the underlying transport in which case the one specified here is ignored.

Messages must conform to the following DTD:-

<!--
Multimedia Message Document Type Definition
(dtd). XML is case-sensitive and this application will 
validate XML documents. 
-->

<!ENTITY % options "p | font | b | i | u | strike | 
   
br | span | img | bgsound">

<!-- Body element. Every thing goes between this.  -->
<!-- Use 'charset="unicode"' to specify Unicode character set encoding.  -->
<!ELEMENT body (#PCDATA | %options; | switch | vcard |
vcal)*>
<!ATTLIST body
    charset CDATA #IMPLIED
    useragent CDATA #IMPLIED>

<!-- New line  -->
<!ELEMENT br EMPTY>
<!ATTLIST br
    useragent CDATA #IMPLIED>

<!-- Font (size) -->
<!ELEMENT font (#PCDATA | %options;)*>
<!ATTLIST font
    size (3 | 4 | 2) "3"
    bgcolor CDATA "#ffffff"
    color CDATA "#000000"
    useragent CDATA #IMPLIED>

<!-- span element: defines background colors around text. 
It follows the syntax of html just of the attribute
'style="background-color: #RGB' where RGB is
the Red Green Blue color. -->
<!ELEMENT span (#PCDATA | %options;)*>
<!ATTLIST span
style CDATA #REQUIRED
useragent CDATA #IMPLIED>

<!-- Text Alignment -->
<!ELEMENT p (#PCDATA | %options;)*>
<!ATTLIST p
    align (left | right | center | default) "default"
    useragent CDATA #IMPLIED>

<!-- Bold -->
<!ELEMENT b (#PCDATA | %options;)*>
<!ATTLIST b
useragent CDATA #IMPLIED>

<!-- Italics -->
<!ELEMENT i (#PCDATA | %options;)*>
<!ATTLIST i
    useragent CDATA #IMPLIED>

<!-- Underlined -->
<!ELEMENT u (#PCDATA | %options;)*>
<!ATTLIST u
    useragent CDATA #IMPLIED>

<!-- Strikethrough  -->
<!ELEMENT strike (#PCDATA | %options;)*>
<!ATTLIST strike
    useragent CDATA #IMPLIED>

<!-- img element: specifies an image (GIF/JPG). -->
<!ELEMENT img EMPTY>
<!ATTLIST img
    src CDATA #IMPLIED
    predef CDATA #IMPLIED
    useragent CDATA #IMPLIED>

<!-- bgsound specify sound element. -->
<!ELEMENT bgsound EMPTY>
<!ATTLIST bgsound
    src CDATA #IMPLIED
    predef CDATA #IMPLIED
    useragent CDATA #IMPLIED>

<!-- vcard element: this is used to send a Vcard to a
phone. The ``src'' attribute is a reference to a
text document containing the contact. -->
<!ELEMENT vcard EMPTY>
<!ATTLIST vcard
    src CDATA #REQUIRED
    useragent CDATA #IMPLIED>

<!-- vcal element: this element is used to send a
Vcalendar object to a phone. The ``src'' attribute
references a text document containing the calendar
event. -->
<!ELEMENT vcal EMPTY>
<!ATTLIST vcal
src CDATA #REQUIRED
useragent CDATA #IMPLIED>

<!-- switch element: switch, case and default elements are 
used to select different content for different phones. -->
<!ELEMENT switch ((case)*,default)>
<!ATTLIST switch
    property CDATA #REQUIRED>

<!-- Switch case element -->
<!ELEMENT case (#PCDATA | %options;)*>
<!ATTLIST case
    value CDATA #REQUIRED>

<!-- Switch case default  element -->
<!ELEMENT default (#PCDATA | %options;)*>

 

Samples are XML files are:-



One image <?xml version="1.0"?>
<!DOCTYPE body PUBLIC "-//NCL//DTD body 1.0//EN" "http://www.ncl.ie/dtd/mmm/1.0/Message.dtd">
<body>
<img src="32x32.gif"/>
</body>
 
Red font <?xml version="1.0"?>
<!DOCTYPE body PUBLIC "-//NCL//DTD body 1.0//EN" "http://www.ncl.ie/dtd/mmm/1.0/Message.dtd">
<body>Normal, <font color="#00ff00">Red</font></body>
 
Text formatting <?xml version="1.0"?>
<!DOCTYPE body PUBLIC "-//NCL//DTD body 1.0//EN" "http://www.ncl.ie/dtd/mmm/1.0/Message.dtd">
<body>Normal, <b>bold</b>, <i>italic</i>, <u>underline</u>,<br/><strike>strike</strike>, <b><i>bi</i></b>, <b><u>bu</u></b>,<br/><i><u>iu</u></i>, <b><u><i>biu</i></u></b>,<br/><br/><font size="2">big</font> <font size="3">a b</font> <font size="4">biggest</font></body>
 
IMelody  <?xml version="1.0"?>
<!DOCTYPE body PUBLIC "-//NCL//DTD body 1.0//EN" "http://www.ncl.ie/dtd/mmm/1.0/Message.dtd">
<body><bgsound src="axelf.imy"/></body>
 
RTTTL Melody <?xml version="1.0"?>
<!DOCTYPE body PUBLIC "-//NCL//DTD body 1.0//EN" "http://www.ncl.ie/dtd/mmm/1.0/Message.dtd">
<body><bgsound src="mission.rtl"/></body>
 
Text and Images <?xml version="1.0"?>
<!DOCTYPE body PUBLIC "-//NCL//DTD body 1.0//EN" "http://www.ncl.ie/dtd/mmm/1.0/Message.dtd">
<body>
Here's a jpeg
<img src="32x32.jpg"/>
and a gif
<img src="mouth.gif"/>
and that's it
</body>
 
Switch statements <?xml version="1.0"?>
<!DOCTYPE body PUBLIC "-//NCL//DTD body 1.0//EN" "http://www.ncl.ie/dtd/mmm/1.0/Message.dtd">
<body>
Hello there <switch property="useragent"><case value="NSM">Nokia</case><case value="SMS">Simple SMS Phone</case><case value="EMS">EMS Phone</case><default>Unknown phone</default></switch> and this is the end of the message.
</body>

 

See Also:
Message, Serialized Form

Constructor Summary
MMSMessage(Address to, java.io.File xmlDocument)
          Create an MMS Message.
MMSMessage(Address to, java.io.File xmlDocument, int sequenceNumber)
           
MMSMessage(Address to, java.lang.String content)
          Create an MMS Message.
MMSMessage(Address to, java.lang.String content, int sequenceNumber)
           
MMSMessage(Address to, java.net.URL xmlDocument)
          Create an MMS Message.
MMSMessage(Address to, java.net.URL xmlDocument, int sequenceNumber)
           
 
Method Summary
 java.lang.Object getBody()
          Get the message body.
 java.lang.String getContent()
           
 int getSequenceNumber()
           
 Message[] getSmsMessageFragments()
           
 java.net.URL getSourceURL()
           
 UserAgent getUserAgent()
           
 boolean isEmsEncodedAsTextMessages()
           
 void resetMessageFragments()
           
 void setBody(java.lang.Object o)
          Set the message body.
 void setContent(java.lang.String content)
           
 void setDestination(Address dest)
          Set the destination address of the message.
 void setEmsEncodedAsTextMessages(boolean emsEncodedAsTextMessages)
           
 void setSourceURL(java.net.URL url)
           
 void setUserAgent(UserAgent userAgent)
           
 
Methods inherited from class ie.ncl.msg.Message
getAttribute, getAttributes, getCorrelationID, getDestination, getID, getSource, getType, putAttribute, removeAttribute, setAttributes, setCorrelationID, setID, setSource, setType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MMSMessage

public MMSMessage(Address to,
                  java.lang.String content)
Create an MMS Message. The content of an MMSMessage can be specified by:
(1) A URL pointing to the XML document,
(2) A File containing the XML document,
(3) The XML Document string itself.


MMSMessage

public MMSMessage(Address to,
                  java.lang.String content,
                  int sequenceNumber)

MMSMessage

public MMSMessage(Address to,
                  java.io.File xmlDocument)
           throws java.net.MalformedURLException
Create an MMS Message. The content of an MMSMessage can be specified by:
(1) A URL pointing to the XML document,
(2) A File containing the XML document,
(3) The XML Document string itself.

Throws:
java.net.MalformedURLException

MMSMessage

public MMSMessage(Address to,
                  java.io.File xmlDocument,
                  int sequenceNumber)
           throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

MMSMessage

public MMSMessage(Address to,
                  java.net.URL xmlDocument)
Create an MMS Message. The content of an MMSMessage can be specified by:
(1) A URL pointing to the XML document,
(2) A File containing the XML document,
(3) The XML Document string itself.


MMSMessage

public MMSMessage(Address to,
                  java.net.URL xmlDocument,
                  int sequenceNumber)
Method Detail

setSourceURL

public void setSourceURL(java.net.URL url)

getSourceURL

public java.net.URL getSourceURL()

setBody

public void setBody(java.lang.Object o)
Description copied from class: Message
Set the message body. This abstract method (and the type of body e.g. String) is defined by the extending class.

Specified by:
setBody in class Message

getBody

public java.lang.Object getBody()
Description copied from class: Message
Get the message body. This abstract method (and the type of body e.g. String) is defined by the extending class.

Specified by:
getBody in class Message

getContent

public java.lang.String getContent()

setContent

public void setContent(java.lang.String content)

setUserAgent

public void setUserAgent(UserAgent userAgent)

getUserAgent

public UserAgent getUserAgent()

setDestination

public void setDestination(Address dest)
Description copied from class: Message
Set the destination address of the message. This may be null for a received message. TODO ??????????????? sounds werid/confusing

Overrides:
setDestination in class Message
See Also:
Address

getSequenceNumber

public int getSequenceNumber()

isEmsEncodedAsTextMessages

public boolean isEmsEncodedAsTextMessages()

setEmsEncodedAsTextMessages

public void setEmsEncodedAsTextMessages(boolean emsEncodedAsTextMessages)

resetMessageFragments

public void resetMessageFragments()

getSmsMessageFragments

public Message[] getSmsMessageFragments()
                                 throws MessageException
Throws:
MessageException

Experts in SMS and MMS Technology. NCLs Provato is an SMS/MMS Gateway supporting  WAP Push, EMS, MMS, SMS, Nokia Smart Messaging, SMPP, CIMD, UCP, MM7, M20, TC35 NCL Technologies Ltd
Provato - SMS MMS Gateway
Mobile Messaging in J2EE & .NET

SwiftNote - Java SMS Toolkit