General
As a JAVA solution, Mobildev JAVA API enables software developers to integrate SMS technology into their solutions and helps them develop platform independent applications in a cost-free way.
JAVA API is accessing http://gateway.mobilus.net/com.mobilus address over HTTP port 80 and thus accessing Mobildev SMS Gateway. If your network is behind a firewall, the computer that uses Mobildev JAVA API must be enabled accessing this address with data transmission in both ways.
Notice: In order to use Mobildev JAVA API, you will need to place the JAR package (Mobilus.jar) to the “lib” folder located under the JAVA SDK folder (e.g. C:\j2sdk1.4.2_04), and add the full path of the JAR package to the CLASSPATH environment variable (e.g. C:\j2sdk1.4.2_04\lib\Mobilus.jar). You can access the JAR file under the Sample JAVA API Codes Section. |
Following is the minimum system requirements list in order to use Mobildev JAVA SMS API solution.
Windows 98 SE, ME, 2000, XP, 2003, Linux, UNIX or MAC OS
Internet Explorer 6 SP1 (for Windows Platform)
JVM - JAVA Virtual Machine (for each operating system)
Before starting with sending SMS, SMS user information control must be carried out. If you don’t have a current SMS account please CLICK HERE to obtain a test account from Mobildev Customer Services.
Mobildev JAVA API offers a method called CreditReporter for user information control. In order to have the user information checked by the Gateway, you will need to call SendMessage () method by inputting your user name (username-company code) to SetUsername(), your password to SetPassword() as parameters. The returning values will be the credit balance and the originator information. The following example shows how CreditReporter method is used.
CreditReporter Method
import com.Mobilus.Sms.*;
class merhaba
{ public static void main(String[] args)
{
try
{
CreditReporter cr = new CreditReporter();
cr.SetUsername("test-mb1000");
cr.SetPassword("1234");
Object[] o = cr.SendMessage();
System.out.println((String)o[0]);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
After submitting the CreditReporter method to the Gateway as in the example, the below values will be returned:
If successful:
Credits remaining <10>
Originator1<10>
Originator2<10>
OriginatorN
After checking the information sent to Gateway, 01 Error Code will be returned if the information is not correct. Error Code 01 means that one or all of the following is incorrect: user name – password – company code. In this case, please contact with Mobildev Technical Support Team and check your login details.
Notice Regarding Characters To Be Used
During sending, the below is not allowed:
Turkish characters (ç,ş,ü,ö,ğ,Ç,Ü,Ş,Ğ,Ö,İ) .
~, ^^, &, <, >, €, £, ã, Ã, ‰, €, ©, ®, ∞, ° signs
LineFeed, Enter, Tab commands
Within a message, only the following characters are allowed: ( ) [ ] { } = * ? \ / % + # ! ” : ; _ |
Notice Regarding GSM Number Format
GSM numbers must be formatted as 05321234567, 5321234567, 905321234567 and written within Numbers parameter node. If the GSM numbers are not written in this format, 04 Error Code will be returned. Error Code 04 means that that GSM number format is not correct. In this case, please consider checking the Notice Regarding GSM Number Format section.
Notice: You cannot send should you format numbers as +905321234567, 532 123 45 67, +05321234567 and use -, ( ), [ ], { } and etc. characters. |
Notice Regarding Sender Information Usage
Sender Information (Alphanumeric/Originator), is the sender name in the messages. This name is 11 characters long and is company dependant. While sending, the exact sender information –provided by the activation unit during account activation- must be quoted within the Originator Parameter node. 06 Error Code will be returned should Sender Information does not match. Error Code 06 means that the Originator information is not defined.
Notice: The Originator statement cannot contain Turkish characters and &, <, >, -, ( ), [ ], / signs. |
Notice Regarding Bulk SMS Sending Method
Mobildev JAVA API provides 2 methods, namely:
Notice: 30.000 is the recommended number for Mobildev JAVA API’s SMS sending packages. |
SmsToMany Method
SmsToMany method is used for sending the same message to different GSM numbers. In order to do this, after getting a sample SmsToMany method,
Input user name to SetUsername() method,
Input password to SetPassword() method,
Input originator information to SetOriginator() method,
Input message text to SetMessage() method (text to be no longer than 160 characters, not to be containing any Turkish characters and the following signs: &, <, >, -, ( ), [ ], /),
Input DayMonthYearHourMinute (ddmmyyyyhhmm) to SetDate() method, if you want to send messages at a later specified time,
Input GSM Numbers to SetNumbers() method, after this, if you call SendMessage() method, the SMS package will be submitted to the Gateway.
Once the package is processed by the Gateway, an appropriate return value will be generated. You can use the return value by transferring SendMessage() method to a variable.
Notice: Username-company_code information must be input to the SetUsername method. |
SetUsername parameter refers to user name associated with your Mobildev SMS account.
SetPassword parameter, refers to password for your SMS user name.
SetOriginator parameter, refers to user name that will be displayed on recipient’s GSM number.
SetDate parameter refers to the sending time of the message.
Sample SmsToMany Method
import com.Mobilus.Sms.*;
class merhaba
{ public static void main(String[] args)
{
try
{
SmsToMany cr = new SmsToMany();
cr.SetUsername("test-mb1000");
cr.SetPassword("1234");
cr.SetOriginator("MOBILDEV");
cr.SetMessage("happy new year");
cr.SetDate("311220121350");
String[] numbers={"05321234567,5059876543"};
cr.SetNumbers(numbers);
Object[] o = cr.SendMessage();
System.out.println((String)o[0]);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
If you submit the SMS package with the SendMessage() method, the Gateway will return the following values:
1. If successful: TimerID information in “ID: 1234567” format will be returned. TimerID is the automatically assigned number to the SMS packages.
2. If an error occurred, please consider checking Error Codes Section.
SmsMultiSender Method
SmsMultiSender method is used for sending different messages to different GSM numbers. In order to do this, after getting a sample SmsToMany method,
Sample SmsMultiSender Method
import com.Mobilus.Sms.*;
class merhaba
{ public static void main(String[] args)
{
try
{
SmsMultiSender multisender = new SmsMultiSender();
multisender.SetUsername("test-mb1000");
multisender.SetPassword("1234");
multisender.SetOriginator("MOBILDEV");
multisender.SetDate("311220122359");
multisender.AddMessage("5321234567", "happy new year");
multisender.AddMessage("5321234568", "don't miss exclusive discount for new year");
multisender.AddMessage("5321234569", "happy new year");
Object[] o = multisender.SendMessage();
System.out.println((String) o[0]);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
If you submit the SMS package with the SendMessage() method, the Gateway will return the following values:
If successful: TimerID information in “ID: 1234567” format will be returned. TimerID is the automatically assigned number to the SMS packages.
If an error occurred: please consider checking Error Codes Section
Mobildev JAVA API offers SmsReporter method for reporting sending of the messages.
After sending of the message, you will get a message sending code as the return value. If you add this value as a parameter to the SetMsgid() method of SmsReporter method, you will be able to get a sending report.
import com.Mobilus.Sms.*;
class merhaba
{ public static void main(String[] args)
{
try
{
SmsReporter cr = new SmsReporter();
cr.SetUsername("test-mb1000");
cr.SetPassword("1234");
cr.SetMsgid("1234567");
Object[] o = cr.SendMessage();
System.out.println((String)o[0]);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
Once the Gateway receives the information it will return the following values:
If successful:
“TimerID<32>GSM Number<32>Status<10>”
Sent message basis reporting (also known as TimerID)
1234<32>905358765432<32>2<10>
1234<32>905428765432<32>3<10>
1234<32>905558765432<32>1<10>
If an error occurred, please consider checking Error Codes Section.
Notice: In the status information, “1” means that the message is awaiting, “2” means that the message was sent and “3” means that the message was not delivered. <32> and <10> return values mean space and LineFeed characters, respectively. |
Notice Regarding OTP Service Usage
API integration for both the OTP Service and the Bulk SMS are exactly the same. While activating the Bulk SMS account, definitions will also be made for OTP Service.
Notice: As OTP SMS is used in only sending passwords and instant notification passwords, no Bulk SMS should be sent. |
Hata Kodu | Açıklama |
01 | Incorrect User Name Incorrect Password Incorrect company code |
02 | Insufficient credits |
03 | Undefined Action value |
04 | No Incoming XML |
05 | Incorrect or missing XML node |
06 | Undefined Originator Information |
07 | Missing message code (ID) |
08 | No SMS were sent for the given dates |
09 | Date fields are empty - incorrect |
10 | SMS was not sent |
11 | Unidentified error |
13 | No user was specified for the report |
Get A Test AccountI Have a Project! |