send configration sms on mobile

Posted: August 7, 2008 in Uncategorized
Tags: , , ,

Q.how to send an configration SMS(like mobile operators send GPRS setting, its an configration SMS)

A.configration SMS is not a simple text sms.you have to send your message usingĀ  Over The Air(OTA) or Open Mobile Alaince (OMA).

you can download OTA spacification document from there but first you have to make a login to nokia forum.open the link make you registration the download the pdf file

http://www.forum.nokia.com/info/sw.nokia.com/id/3377eb33-cb1d-490e-a1cb-8735d785e1d3/OTA_settings_general_7_0.pdf.html

you can also download OMA specification

http://www.forum.nokia.com/info/sw.nokia.com/id/8d85ad81-5a9b-40fe-bf2a-d567dfd755ec/Series_40_DP_2_0_OMA_Client_Provisioning_v1_3_en.pdf.html

-i wanna send configration sms for synch settings . for that i read the these above spacification(parameters required).
-then i create an xml according to OMA/OTA spacification.
-and concert this xml to wbxml

how convert xml to wbxml
there is two solution for that, you can find two APIs on the internet
-wbxml this is c++ library
can be downlaoded for here http://libwbxml.aymerick.com/
-kxml this is java library
can be donwlaod from here http://kxmlrpc.objectweb.org/software/downloads/

i converted my xml to wbxml using kxml api.here is code

package test.kxml;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.kxml.io.AbstractXmlWriter;
import org.kxml.kdom.Document;
import org.kxml.parser.XmlParser;
import org.kxml.wap.WbxmlWriter;

public class Converter {

public static void main(String args[]){

byte[] bytes=null;

try {
File file = new File(“D:\\xml\\OMA2.xml”);

InputStream is = new FileInputStream(file);

// Get the size of the file
long length = file.length();

// You cannot create an array using a long type.
// It needs to be an int type.
// Before converting to an int type, check
// to ensure that file is not larger than Integer.MAX_VALUE.
if (length > Integer.MAX_VALUE) {
// File is too large
}

// Create the byte array to hold the data
bytes = new byte[(int)length];

// Read in the bytes
int offset = 0;
int numRead = 0;
while (offset < bytes.length
&& (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
offset += numRead;
}

} catch (Exception e) {
// TODO: handle exception
}

try {
FileOutputStream fOutStream = new FileOutputStream(“D:\\xml\\OMA2.wbxml”);
// Construct an InputStreamReader on ByterArrayInputStream.
InputStreamReader in = new InputStreamReader(new ByteArrayInputStream(bytes));

// Make parser using this Reader.
XmlParser parser = new XmlParser(in);

// Construct a DOM Document to parse XML.
Document document = new Document ();
document.parse(parser);
in.close();

// Make an OutputStream on which WbxmlWriter can write.
ByteArrayOutputStream out = new ByteArrayOutputStream();
//AbstractXmlWriter writer = new WbxmlWriter(out);

AbstractXmlWriter writer = new WbxmlWriter(fOutStream);
document.write(writer);
writer.close();

System.out.println(“————-”+out.toString());
//out.writeTo(fOutStream);
// Get WBXML from this stream.
bytes = out.toString().getBytes();

out.close();

}//try
catch (Exception e) { e.printStackTrace(); }

}//End of MAin

}

i also have the exe file of wbxml lib(complied and convert to exe). you can run it on command promt.
place the xml file and related dll in a folder the open the command promt and point to that folder and the write that command
xml2wbxml.exe
then write this command
xml2wbxml -o output.wbxml input.xml
xml2wbxml -k -n -v 1.1 -o output.wbxml input.xml

then your file convertd to wbxml. for wbxml exe file you can email me at aijaz.a.b@gmail.com

wbxml is short form of xml mean all xml data converted to binary so file size get commpressed. when you convert the xml to wbxml you will see all tags are converted into binary form but the text will remain the same.
then convert it to Hexadecimal form and send it to your mobile.

downlaod hex-editor form that link http://www.brothersoft.com/free-hex-editor-download-40299.html, it will convert wbxml to hex.

how to send to the mobile you have to read your gate spacificatio. i am using unwire gateway so for that i set the “type” varibale to “raw” in the url and set the header.i didnt able to get sms on mobile therefor i contacted to my gateway provider but these all step really help to send the configration SMS.

the sms you will send it will have two parts
first is UDH head
what is UDH head read this link

http://dev.mobi/article/binary-sms-sending-rich-content-devices-using-sms

the samlple i send like this
(UDH header)Header1: 0B0504C34FC0020003B90201
(hexdecimal form of wbxml)Body1: 010604039481EA00010045C60601871245018713110331302E392E382E37000187146101872111032B333637303730303039323700018722700187231103766F6461776170000187241103766F646177617000018728730187296C0101C606018712410187131103323232000187146001871A11032B33363730393939363530
Header2: 0B0504C34FC0020003B90202

hope this all will help

also read this link .might be it will be helpful

http://dev.mobi/article/email-configuration-sms

this is the example that i tryied with some gatway

i used this url of my gateway provider to send sms on mobile

http://mobile.unwire.dk/java/servlet/smspush?user=test&password=test&to=92322111111&smsc=dk.tdc&udh=0605040B840000&text=02056A0045C60C037777772E6465762E6D6F62692F69735F66756E2E68746D6C0011033635333200070103446576446F744D6F62692069732046756E2021000101&phoneno=92322111111&mediacode=ijazcompnay&appnr=321&from=ijax&type=raw&

see type variable

cheeeeeeeeeeeeeeerz

Comments
  1. Diana says:

    Hi, you have unfortunately forgotten to post the body of the socond sms. :(

  2. ijaxahmed says:

    see the example i pasted now…this is the example that i tried with my gateway …but that vary from gateway to gateway …read you gateway document and see how send an OTA

  3. I’m amazed, I have to admit. Rarely do I come across a blog that’s equally educative and engaging, and without a doubt, you have hit the nail on the head. The issue is an issue that too few men and women are speaking intelligently about. I am very happy that I found this during my hunt for something concerning this.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s