using System;
using System.Xml;
using System.Web.Services;

namespace WebServiceTest
{	
	public class abctextexample
	{
		[STAThread]
		static void Main(string[] args)
		{
			try
			{
				//variable declarations
				ws_SMS.SMS oService = new ws_SMS.SMS();
				ws_Session.Session oSession = new ws_Session.Session();
				ws_SMS.AuthorizationHeader oHeader = new ws_SMS.AuthorizationHeader();
				ws_SMS.SMSRecipient[] oSMSRecipient = {new ws_SMS.SMSRecipient()};
				ws_SMS.SMSResponse oSMSResponse;
				ws_SMS.SMSRequest oSMSRequest = new ws_SMS.SMSRequest();
				string sGUID;

				//Get a valid GUID from abctext.com
				sGUID = oSession.StartSession(YOUR_USERNAME, YOUR_PASSWORD);

				//Set the SOAP Header
				oHeader.SessionKey = sGUID;
				oService.AuthorizationHeaderValue = oHeader;

				//Prepare the object
	            oSMSRequest.Message = "A test message";
	            oSMSRequest.Unicode = false;
	            oSMSRequest.Sender = "abctext.com";
	            oSMSRequest.MessageType = ws_SMS.MessageType.Text;
				oSMSRecipient[0].Number = MOBILE_PHONE_NUMBER;
	            oSMSRequest.Recipients = oSMSRecipient;

				//Call the service
				oSMSResponse = oService.QuickSend(oSMSRequest);

				//Kill the Session with abctext.com
				oSession.EndSession(sGUID);
			}
			catch (System.Web.Services.Protocols.SoapException se)
			{
				Console.WriteLine("Message      : " + se.Detail.InnerText);
				Console.WriteLine();
			}
			catch (System.Net.WebException we)
			{
				Console.WriteLine("Message      : " + we.Message);
				Console.WriteLine();
			}
			catch (Exception e)
			{
				Console.WriteLine("Message      : " + e.Message);
				Console.WriteLine();
			}
		}
	}
}

