WEB Services API Details :

Send SMS :

http://mshastra.com/send_sms_web_service.asmx

*smstype : 0 = Transactional one,3 = Transactional Optin,4 = Promotional,13 = Transactional OTP,9 = Transactional two,6=Transactional three

ASP.Net (C#) Code Sample : (Send SMS)

Step 1- Create a Web Site by File > New > Web Site > Asp.net Web Site
Step 2- Right-click Solution Explorer and choose “Add Web Reference”.
Paste the URL of the web service(http://mshastra.com/send_sms_web_service.asmx) and click on ‘Go’ button and then ‘Add reference’.

And give the namespace, here we give ‘SEND_SMS’

SEND_SMS.send_sms_web_service mys = new SEND_SMS.send_sms_web_service();// you need to create the object of the web service
string name = username.Text;
string pwd = password.Text;
string message = msg.Text;
string number = mobile.Text;
string sendername = senderid.Text;
string language = “”;
string country_code = “All”;
string api_key = “”;
string scheduled_date = “”;
string smstype = “”;
string param_1 = “”;
string param_2 = “”;
string param_3 = “”;
string result = mys.send_sms(name, pwd, sendername, number, message, country_code,api_key,scheduled_date,smstype,language,param_1,param_2,param_3);
lbl.Text = result;

ASP .NET (VB) Code Sample : (Send SMS)

‘This is done on visual studio
‘Just create a new project of vb on VS Studio
‘Right Click on Solution Exloprer of project and Selct Add Web Refernces
‘On popup box give url as ‘http://mshastra.com/send_sms_web_service.asmx’ on textbox and select GO
‘And give the namespace, here we give SEND_SMS’
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
‘create object to send_sms_web_service class, which is under namespace we given
Dim client As New SEND_SMS.send_sms_web_service ()
‘give the username,password,…..
‘method for sending text sms
MsgBox(client.send_sms(“name”, “pwd”, “sendername”, “number”, “message”, “country_code”,”api_key”,”scheduled_date”,”smstype”,”language”,”param_1″,”param_1″,”param_1″))
End Sub
End Class

Java Code Sample : (Send SMS)

/* This client program developed by using AXIS2 of Apache
* set the classpath to all jar files in LIB directory of AXIS2 api
* use ServiceStub class generated by WSDL2JAVA tool,set JAVA_HOME,AXIS2_HOME System variables
*/
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties;
import org.apache.axis2.databinding.types.UnsignedLong ;
public class Client{
/* SETUP your SENDERID

*/
static String SID=”Your SENDERID”; //assign your senderid otherwise give empty string
public static void main(java.lang.String args[])throws Exception
{
ServiceStub stub =new ServiceStub();
/* Setup the proxy */
HttpTransportProperties.ProxyProperties proxyProperties = new HttpTransportProperties.ProxyProperties();
proxyProperties.setProxyName(“your PROXY”);
proxyProperties.setProxyPort(YOUR PORT NO);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(200*1000)); // give ur choice of number in Integer
stub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.PROXY, proxyProperties);
/* call the methods,while calling the methods
* you should set the setters in method definitions below like username,password,….
* and also enter message in hexa format for unicodesms,logo,picture,ringtone sms
*/
send_sms(stub);
} //end of main method

/* method for send Text SMS,Which internally interacts the SERVICESTUB class */
/* GIVE YOUR DETAILS */
public static void send_sms(ServiceStub stub)
{
try
{
“name”, “pwd”, “sendername”, “number”, “message”, “country_code”,”api_key”,”scheduled_date”,”smstype”,”language”,”param_1″,”param_1″,”param_1″
ServiceStub.send_sms sendmesg = new ServiceStub.send_sms();
sendmesg.setUsername(“USERNAME “);
sendmesg.setPassword(“PASSWORD “);
sendmesg.setSenderID(SID);
sendmesg.setMobilenumbers(“9199XXXXXXXX,91XXXXXXXXXX,….”);
sendmesg.setMessage(“TYPE YOUR MESSAGE”);
sendmesg.setCountryCode(“All”);
sendmesg.setApi_Key(“”);
sendmesg.setScheduled_Date(“”);
sendmesg.setSmsType(“”);
sendmesg.setLanguage(“”);
sendmesg.setParam_1(“”);
sendmesg.setParam_2(“”);
sendmesg.setParam_3(“”);
ServiceStub.SendTextSMSResponse response=stub.SendTextSMS(sendmesg);
System.out.println(response.getSendTextSMSResult());
}

catch(Exception e)
{
System.out.println(“this is from catch”);
e.printStackTrace();
}

}