Sending SMS to server - Wireless Messaging API (WMA)

Hello :-)!
In general I want to create application for CLDC (with the use of MIDlet). (And maybe later to try the same with CDC). I want my application to create some data based on communication with the user of mobile phone and then to send little text file to the application on server computer.
I found that there exists such a thing as WMA - Wireless Messaging API. I downloaded examplary .jar & .jad files (with sources and documentation):
[http://www.forum.nokia.com/info/sw.nokia.com/id/9edb3299-e0f4-449d-a2fd-fa15ddbeed8b/MIDP_2_0_Wireless_Messaging_API_Example_v1_0.zip.html|http://www.forum.nokia.com/info/sw.nokia.com/id/9edb3299-e0f4-449d-a2fd-fa15ddbeed8b/MIDP_2_0_Wireless_Messaging_API_Example_v1_0.zip.html]
and copied those files to Sony Ericsson K750i. I installed the application, run it, it asked me whether I want to allow this application to receive SMS, I answered yes and... nothing else happened and the application exited. I run this application once more, it doesn't do anything at all and exits.
I tried to analyse the code but it didn't help me to notice what is wrong with the program.
In init() there is initialization of what and where will be sent (port number and message). (Function init is called in startApp so in my application I will need to call it in the other place in the code and I will take the content of the message from the other place that jar or jad files, as in this examplary application).StartApp() calls init(), it listens to incoming messages, creates commend, label etc. (Probably I need to erase from this example code responsible for listening to incoming messages so that this examplary application will work on my Sony Ericsson?).
CommandAction(c,d) sends text or binary message (depending on choice in the field cg.setSelectedIndex) or exits the application for "exit".
ItemStateChanged() changes from binary to text mode and vice versa.
SendBinaryMessage(connection,destAddress,Body) and sendTextMessage(...) send the message.
I don't know what are those "private static final String".>
Greetings:)!

{color:#000080}Learn to live with it, this is the specified behavior for SMS sending. Unless you can hack your phone's firmware, there's nothing you can do about it.
db{color}

Similar Messages

  • Wireless Messaging API (WMA);

    Hello, I am new to J2ME and I have two question regarding the Wireless Messaging API
    1) In J2SE, I can find the J2SE api by going to google and searching for "java api"
    However, I am having a difficult time finding the WMA api.
    2)
    When using the WMA api to send text message.
    is there anyway to disable the warning message "Allow application WMA Demo to send text message to 778-xxx-xxxx?"
    This message is very annoying.
    Thank you for your help

    {color:#000080}Learn to live with it, this is the specified behavior for SMS sending. Unless you can hack your phone's firmware, there's nothing you can do about it.
    db{color}

  • Is it possible to send sms to groups from Messages in the new iOS8?

    Is it possible to send sms to groups from Messages in the new iOS8?

    Of course.  This feature has been part of iOS for a while now.
    http://lmgtfy.com/?q=send+group+sms+from+iPhone

  • Wireless Messaging API

    Hi you all,
    I am trying to send messages over GSM using the WMA API, but I am rather new to J2ME and I am struggling to understand a few things.
    I have been searching and I found this code:
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.io.*;
    import javax.wireless.messaging.*;
    public class SMSClient extends MIDlet {
        protected Display display;
        protected Displayable displayable;
        public SMSClient() {
         display = Display.getDisplay(this);
         displayable = new Form("SMS Client");
        public void startApp() {
         display.setCurrent(displayable);
         try {
             String address =  "sms://+5550000:5432";
             String msg = "Hello";
             MessageConnection smsconn =
              (MessageConnection) Connector.open(address);
             TextMessage txtmessage =
              (TextMessage)smsconn.newMessage(
                          MessageConnection.TEXT_MESSAGE);
             txtmessage.setPayloadText(msg);
             smsconn.send(txtmessage);
         } catch (Exception e) {
             System.out.println(e.toString());
        public void pauseApp() {
        public void destroyApp(boolean unconditional) {
         display = null;
         displayable = null;
    }Which allows me to send sms messages. What I am not undertsnding thought is this bit:
             String address =  "sms://+5550000:5432";Don't I need to use any gateway to send the message???
    Another issue I am having is about the above package:
    import javax.microedition.midlet.*;which doesn't come included in the J2ME version I am using... But as far as I know that package is only used for GUI applications, I am wrong??
    Thanks in advance.
    MeTitus
    Message was edited by:
    Me_Titus

    Hi deepspace...
    I am developping for this module
    http://www.imsys.se/products/modules.htm
    and these are the packages that come with it:
    com.dalsemi.onewire
    com.dalsemi.onewire.adapter
    com.dalsemi.onewire.container
    com.dalsemi.onewire.utils
    com.dalsemi.system
    java.io
    java.lang
    java.net
    java.util
    javax.comm
    javax.microedition.io
    se.imsys.comm
    se.imsys.net
    se.imsys.ppp
    se.imsys.protocol.http
    se.imsys.system
    se.imsys.utilThe code I am developping is not supposed to have any interface. Basically it will check messages from a pop server, and will send some of those messages to mobile phones, This device also has a gsm antenna...
    I am really lost with this...
    MeTitus

  • Run Wireless message API

    Hi all,
    I downloaded and installed J2ME toolkit and WMA packages.
    Any one know how to develop simple example for sending sms message.
    please post simple example and any additional requirements in step wise.
    I will really appreciate.
    Thanks,
    Bala Datla

    http://wireless.java.sun.com/midp/ttips/wma/

  • Sending sms from server

    Well i have to send short message from webserver to any client.But not from client to client.Like any products inforamtions to clients.Because i can't find api in any webserver to send sms to client.While from client I have found api in sl45i to send to any smsc server.But not in webserver.
    I i will make this possible.
    Thanks
    Jawwad Ahmed

    I don't quite understand what you are trying to do but so far, here is what I have understood.
    1. You want to send SMS from Webserver to your mobile phone
    2. Want J2ME Emulator to process SMS.
    <1> Sending SMS from webserver is quite easy. You have several options:(a) connect a mobile phone to your server and 'talk' to the phone using Gnokii or GSMLib to send SMS. The mobile phone will take care of communicating with SMSC of your provider (b) get in touch with your provider and ask if you can connect to their SMSC directly. Some allow you to connect to their SMSC via a modem connection (c) look for public SMSC's, which are scarce.
    <2> Unfortunately, MIDP 1.0 does not allow you to retrieve SMS from the phone... nor does the Siemens SDK, AFAIK. You cannot process SMS using the Emulator as well. You need a real device to test your application.

  • Not able to send SMS  " Application server error"

    Hi Experts,
    I am trying to send sms using one URL . but it is giving application server error. if i seperately copy this url on internet explor it is working fine .
    I am getting error in below methos
    call method client->receive
    exceptions
    http_communication_failure = 1
    http_invalid_state = 2
    http_processing_failed = 3
    others = 4.
    returning 1  and error message
    <html><head><title>Application Server Error</title>##<style type="text/css">##body { font-family: arial, sans-serif;}##</style>##</head>##<BODY text="#172972" link="#808080" vlink="#808080"##alink="#8e236b" bgcolor=white  leftmargin="0" topmargin="0"##mar
    below is the code
    call function 'SCP_CODEPAGE_FOR_LANGUAGE'
    exporting
    language = 'L'
    importing
    codepage = i_codepage
    exceptions
    no_codepage = 1
    others = 2.
    data : I_msg type string.
    ***Repalcing the starnge characters
    call function 'SCP_REPLACE_STRANGE_CHARS'
    exporting
    intext = I_message
    in_cp = i_codepage
    importing
    outtext = I_msg
    exceptions invalid_codepage = 1
    codepage_mismatch = 2
    internal_error = 3
    cannot_convert = 4
    fields_not_type_c = 5
    others = 6.
    endif.
    gv_sms_number = I_SMS_number.
    ****Check the recipient Number
    replace all occurrences of '+' in gv_sms_number with ' '.
    condense gv_sms_number no-gaps.
    data: client type ref to if_http_client,
          url type string.
    ****Build the  URL
    url created
    ****Create the HTTP client
    call method cl_http_client=>create_by_url
    exporting url = url
    importing client = client
    exceptions others = 1.
    *****Set the Request type to GET******
    ***Sets the value of the specified header field
    client->request->set_header_field( name = '~request_method' value = 'GET' ).
    CALL METHOD client->send
        EXCEPTIONS
          http_communication_failure = 1
          http_invalid_state         = 2.
    **client->request->set_header_field( name = '~request_method' value = 'GET' ).
    "#EC *
    ****Make the call client->send( ).
    ****Receive the Response Object
    call method client->receive
    exceptions
    http_communication_failure = 1
    http_invalid_state = 2
    http_processing_failed = 3
    others = 4.
    if sy-subrc <> 0.
      call method client->get_last_error
        importing
         code    = gv_subrc
         message = gv_errortext.
    endif.

    Hi,
    Pls see this link... Re: Sending SMS frm SAP

  • Problem in sending SMS via using java communication API

    I need to send SMS via my sony ericsson Z530i. It is connected to the com5 port of my system. I got the following code.
    import java.io.*;
    import java.util.BitSet;
    import javax.comm.*;
    import java.lang.*;
    public class SerialToGsm {
        InputStream in;
        OutputStream out;
        String lastIndexRead;
        String senderNum;
        String smsMsg;
        SerialToGsm(String porta) {
            try {
    //            CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier("com5");
                CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(porta);
                SerialPort sp = (SerialPort)portId.open("Sms_GSM", 0);
                sp.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
                sp.setFlowControlMode(sp.FLOWCONTROL_NONE);
                in = sp.getInputStream();
                out = sp.getOutputStream();
                // modem reset
                sendAndRecv("+++AT", 30);       // delay for 20 sec/10
                sendAndRecv("AT&F", 30);
                sendAndRecv("ATE0", 30);        // echo off
                sendAndRecv("AT +CMEE=1", 30);  // verbose error messages
                sendAndRecv("AT+CMGF=0", 70);   // set pdu mode
    //            sendAndRecv("AT V1E0S0=0&D2&C1", 1000000);
            catch (Exception e) {
                System.out.println("Exception " + e);
             System.exit(1);
        private String sendAndRecv(String s, int timeout) {
            try {
                // clean serial port input buffer
                in.skip(in.available());
                System.out.println("=> " + s);
                s = s + "\r";         // add CR
                out.write(s.getBytes());
                out.flush();           
                String strIn = new String();
                for (int i = 0; i < timeout; i++){
                    int numChars = in.available();
                    if (numChars > 0) {
                        byte[] bb = new byte[numChars];
                        in.read(bb,0,numChars);
                        strIn += new String(bb);
                    // start exit conditions
                    if (strIn.indexOf(">\r\n") != -1) {
                        break;
                    if (strIn.indexOf("OK\r\n") != -1){
                        break;
                    if (strIn.indexOf("ERROR") != -1) { // if find 'error' wait for CR+LF
                        if (strIn.indexOf("\r\n",strIn.indexOf("ERROR") + 1) != -1) {
                            break;                                            
              Thread.sleep(100); // delay 1/10 sec
                System.out.println("<= " + strIn);
                if (strIn.length() == 0) {
                    return "ERROR: len 0";
                return strIn;
            catch (Exception e) {                 
                System.out.println("send e recv Exception " + e);
                return "ERROR: send e recv Exception";
        public String sendSms (String numToSend, String whatToSend) {
            ComputeSmsData sms = new ComputeSmsData();
            sms.setAsciiTxt(whatToSend);
            sms.setTelNum(numToSend);
    //        sms.setSMSCTelNum("+393359609600");  // SC fixed
            String s = new String();
            s = sendAndRecv("AT+CMGS=" + (sms.getCompletePduData().length() / 2) + "\r", 30);
    //        System.out.println("==> AT+CMGS=" + (sms.getCompletePduData().length() / 2));
    //        System.out.println("<== " + s);
            if (s.indexOf(">") != -1) {
    //            s = sendAndRecv(sms.getSMSCPduData() + sms.getCompletePduData() + "\u001A"); // usefull one day?
    //            System.out.println("Inviero questo >>>> " + sms.getCompletePduData());
                   // if this sintax won't work try remove 00 prefix
                s = sendAndRecv("00" + sms.getCompletePduData() + "\u001A", 150);
    //            System.out.println("<== " + s);
                return s;
            else {
                return "ERROR";
        // used to reset message data
        private void resetGsmObj() {
            lastIndexRead = null;
            senderNum = null;
            smsMsg = null;
        public String checkSms (){
            String str = new String();
            String strGsm = new String();                         
            strGsm = sendAndRecv("AT+CMGL=0", 30);  // list unread msg and sign them as read
            // if answer contain ERROR then ERROR
            if (strGsm.indexOf("ERROR") != -1) {
                resetGsmObj();
                return strGsm; // error
            strGsm = sendAndRecv("AT+CMGL=1", 30);  // list read msg
            // if answer contain ERROR then ERROR
            if (strGsm.indexOf("ERROR") != -1) {
                resetGsmObj();
                return strGsm; // error
            // evaluate message index
            if (strGsm.indexOf(':') <= 0) {
                resetGsmObj();
                return ("ERROR unexpected answer");
            str = strGsm.substring(strGsm.indexOf(':') + 1,strGsm.indexOf(','));
            str = str.trim(); // remove white spaces
    //        System.out.println("Index: " + str);
            lastIndexRead = str;
            // find message string
            // look for start point (search \r, then skip \n, add and one more for right char
            int startPoint = strGsm.indexOf("\r",(strGsm.indexOf(":") + 1)) + 2;
            int endPoint = strGsm.indexOf("\r",startPoint + 1);
            if (endPoint == -1) {
                // only one message
                endPoint = strGsm.length();
            // extract string
            str = strGsm.substring(startPoint, endPoint);
            System.out.println("String to be decoded :" + str);
            ComputeSmsData sms = new ComputeSmsData();
            sms.setRcvdPdu(str);
    //        SMSCNum = new String(sms.getRcvdPduSMSC());
            senderNum = new String(sms.getRcvdSenderNumber());
            smsMsg = new String(sms.getRcvdPduTxt());
            System.out.println("SMSC number:   " + sms.getRcvdPduSMSC());
            System.out.println("Sender number: " + sms.getRcvdSenderNumber());
            System.out.println("Message: " + sms.getRcvdPduTxt());
            return "OK";
        public String readSmsSender() {
            return senderNum;
        public String readSms() {
            return smsMsg;
        public String delSms() {  
            if (lastIndexRead != "") {               
                return sendAndRecv("AT+CMGD=" + lastIndexRead, 30);
            return ("ERROR");
    }When i compile, there is no error. But when i execute it, the following error comes:
    E:\java\JavaSmsApi>javac SerialToGsm.java
    E:\java\JavaSmsApi>java SerialToGsm
    Exception in thread "main" java.lang.NoSuchMethodError: main
    What might be the error? Somebody help me. Thanks in advance.

    You are probably trying to run this as a CLDC application instead of a MIDP application (aka a MIDLet). Since CLDC apps start with a main(....) your runtime looks for one but does not find it, hence the error. Please recheck the project configuration.

  • J2ME WMA wireless messaging api

    Hi
    Does anyone know if I can use the WMA from J2ME in my normal Java 1.4 SE version to encode and decode SMS messages that I have recieved from a cell phone via the serial port buy calling AT+ commands???
    I am writing my own pdu sms message converter but there are too many aspects to cover I think...
    Any help or insight will be much appreciated.
    Thanks
    Pug206Aid

    I too looking for the same, my requirement is just recieving a sms from gsm mobile and feeding to the system. Can any one suggest what technology can be used for this, what should be real time environment.
    Thanks in Adv..
    Best Regards,
    Sridhar G

  • CANT SEND SMS ON NEW 6220 - MESSAGE CENTRE ISSUE

    Hi all
    Just got a brand new 6220 on 3 network. my problem is that i cant sent sms but can recieve. when i tried to send an sms at first it asked for a centre no i just put in 1 for some reason and as expected it didnt send.
    how do i manually input my sms centre number which i got off my old 3 phone
    i have tried messeging - settings - text message - message centre in use - message centre
    problem is i cant change centre number
    begging for help

    And, usually, the message centre number is on the SIM card, and the phone reads it automatically.
    Sometimes the SIM can go bad, or the phone has some other trouble reading the number from the SIM card.
    Then you can define/add the number manually, but you do need to ask your network operator (service provider, carrier) whose SIM card you have to give the number. It might also be posted on their web site.

  • Wireless Messaging API simulator

    hi,
    does anybody know about simulator that can simulate sms
    for testing the WMA?

    hi,
    http://java.sun.com/j2me/docs/wtk2.0_b2/SMSDemo.html
    hope it's useful for u.

  • Can we use MIDP 1.0 to send SMS from mobile phone to server

    hello,
    I want to develop MIDlet which send sms from mobile phone to server
    using midp 1.0
    and also if any one knows about the mobile phone which suppoet midp 1.0 (java enabled) then tell me
    thanks in advance
    s.j.koradiya

    hi,
    SMS API(WMA) is an optional package. It is not a MIDP1.0 or MIDP2.0 api's.
    There are phones which has WMA api with MIDP1.0 support .... Nokia 3650
    Seimens has some phone with their own api's to send sms.Check out seimens site for more info
    BTW, What do you mean buy sending SMS to Server????
    If you want to send message to server you can do it with Http.
    HTH
    phani

  • Re: Sending SMS and Recieving SMS from chat server

    Hi all, I would like to know how can i send sms from J2ME wireless toolkit to a macromedia flash socket server (electroserver) and recieved a feedback from the server that the message is successfully recieved.
    as example of what i want was:-
    1. user send a sms using j2me wireless toolkit to chat in the flash client chat (IRC)
    2. if is a new user, user will need to register their nickname on the server and the server will acknowledge them wether their nickname is already in used or not. so the server will reply the SMS.
    Is there any way to do it using J2ME wireless Toolkit or the server may not support such function. please help me and give some advice on how to make this work. Help from all is much appreciated.
    Thanks.

    You may try this tip for sending SMS from your computer:
    Send/Recieve SMS from computer
    http://www.java-tips.org/content/view/96/39/

  • Wireless Messaging From Servlet

    Can I send wireless messages from a servle using Wireless Messaging API ???
    I have a little test (taken from http://jan.netcomp.monash.edu.au/internetdevices/wireless/wma.html).
    There's a client that send messages, and a server that listens for incoming messages.
    It work fine when I run the both under J2ME emulator, the client sends the messages ok and the server receive ok too.
    Now I want to send the messages from a servlet. So I left the server unchanged and put the client code in the servlet but it doesn't works
    The client's something like this
    try
    String address = "sms://+5550000:5432";
    String msg = "Hello";
    MessageConnection smsconn = (MessageConnection) Connector.open(address);
    TextMessage txtmessage = (TextMessage)smsconn.newMessage(MessageConnection.TEXT_MESSAGE);
    txtmessage.setPayloadText(msg);
    smsconn.send(txtmessage);
    catch (Exception e)
    System.out.println(e.toString());
    System.out.println (e.getMessage());
    e.printStackTrace();
    But running in the servlet, when opening the MessageConnection it throws an IOException "java.io.IOException: NYI".
    Any Ideas??
    Thanx

    From a servlet I got it working (sends the messages ok from the servlet to the device listening).
    I did it using the wma-tck.jar bundeled with Wireless Messaging API.
    The servlet code to send the message's something like this.
    String address = "sms://+5550000:5432"; //phone_number:port on wich the device is listening
    String message = "MESSAGE";
    MessageConnection conn = null;
    Message mess = null;
    conn = (new SMSConnector()).open(address);
    mess = conn.newMessage("text");
    ((TextMessage)mess).setPayloadText(message);
    mess.setAddress(address);
    conn.send(mess);

  • Send SMS via Bluetooth connection

    Hi,
    I have connceted a moblie to my PC through bluetooth (using Bluesoleil)
    Now using program I need to send message to that mobile, such that that mobile should transmit an SMS.
    message from Pc should contain the payload message, SMS receiving phone number.
    Pc -----<bluetooth>----------> mobile -----------Transmit-------------> SMS receiving mobile
    message SMS
    Try to help me with code or Suggest me to proceed
    Thanks in advance.

    Hello Johnerlit do u have any idea regaring this topic?
    Hello everybody!
    I am under a process to send sms from server that is a PC to a mobile through a mobile, which is connected to the PC act as a modem.
    According to my process if the modem is GSM or CDMA, should transmit the sms, that obtained a message from PC.
    The connection between the PC and the modem should be through bluethooth, but at initial I wish to try with data cable before trying with bluetooth connection.
    I should not use any sms operators like Clickatell..
    Can anyone say me is it possible to use J2me in Pc to develop the application and connect to the modem...
    If I am wrong plz say me ur suggestion on how to proceed with this process, and also say if anyother better way is there to do.
    Thanks in advance

Maybe you are looking for