Imports System
Imports System.Xml
Imports System.Web.Services

Module Client
    Sub Main()
        Try
            ' variable declarations
            Dim oService As New abctext.ws_SMS.SMS
            Dim oSession As New abctext.ws_Session.Session
            Dim oHeader As New abctext.ws_SMS.AuthorizationHeader
            Dim oSMSRecipient(0) As abctext.ws_SMS.SMSRecipient
            Dim oSMSResponse As abctext.ws_SMS.SMSResponse
            Dim oSMSRequest As New abctext.ws_SMS.SMSRequest
            Dim sGUID As String

            ' 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
            With oSMSRequest
                .Message = "A test message"
                .Unicode = False
                .Sender = "abctext.com"
                .MessageType = abctext.ws_SMS.MessageType.Text
                oSMSRecipient(0) = New abctext.ws_SMS.SMSRecipient
                oSMSRecipient(0).Number = MOBILE_PHONE_NUMBER
                .Recipients = oSMSRecipient
            End With

            ' Call the service
            oSMSResponse = oService.QuickSend(oSMSRequest)

            ' Kill the Session with abctext.com
            oSession.EndSession(sGUID)

        Catch se As System.Web.Services.Protocols.SoapException
            Console.WriteLine("Message      : " & se.Detail.InnerText)
            Console.WriteLine()

        Catch we As System.Net.WebException
            Console.WriteLine(we.Message)
            Console.WriteLine()

        Catch e As Exception
            Console.WriteLine(e.Message)
            Console.WriteLine()
        End Try
    End Sub

End Module


