Visual Studio .NET makes it very simple to use the SOAP interface to send and receive text messages. Full samples are provided in:
To use the SOAP interface to send an SMS message with .NET using Visual Studio 2005:
Create a Web Reference
- On the Project menu, click Add Web Reference
- In the URL box of the Add Web Reference dialog box, type 'https://www.esendex.com/secure/messenger/soap/sendservice.asmx'
- Click GO.
- In the Web reference name box, rename the Web reference to 'messenger'.
- Click Add Reference.
Visual Studio downloads the service description and generates a proxy class to interface between your application and the Esendex SMS Web Services.
Example code
To send a message write the following:
[C#]
messenger.SendService service = new messenger.SendService();
messenger.MessengerHeader header = new messenger.MessengerHeader();
header.Username = "user@company.com"; // your user name
header.Password = "password"; // your password
header.Account = "447777111222"; // your account reference
service.MessengerHeaderValue = header;
service.SendMessage("447777111333", "Hello World", messenger.MessageType.Text);
[Visual Basic]
Dim service As messenger.SendService
Dim header As messenger.MessengerHeader
service = New messenger.SendService
header = New messenger.MessengerHeader
header.Username = "user@company.com" ' your user name
header.Password = "password" ' your password
header.Account = "447777111222" ' your account reference
service.MessengerHeaderValue = header
service.SendMessage("447777111333", "Hello World", messenger.MessageType.Text)
Notes
The service aliasing feature within the SendMessageFull and SendMessageMultipleRecipientsFull methods of SendService is not available with Evaluation or Premium accounts. When using these methods, you must set the Originator parameter to your account reference or you will receive an error when attempting to send a message.