1 Attachment(s)
C# Newbie - Using SOAP to send SMS
Hi,
I'm new to C# and would greatly appreciate some assistance in puting together a simple form a which would allow me to send an SMS via SOAP.
The technical documentation can be found here http://www.aql.com/site/devel_soap.php
I've made a reference to the WSDL file and now have the following .cs, copy attached in .txt file.
An example I've been given for using the above was: -
VB Code:
public void sendansms()
{
string [] destarr = new string[1];
destarr[0] = "44711111111";
destarr[1] = "44722222222";
cpLatestBrief.authValue = new auth();
cpLatestBrief.authValue.username = "myusername";
cpLatestBrief.authValue.password = "mypassword";
string creditsused;// = new string("");
string outdesr;// = new string("");
System.DateTime dt = DateTime.Now;
testwebserv1.WebReference.callbackelement cbe = new callbackelement();
cbe.callbackurl = "http://url.com";
cbe.callbacktype = testwebserv1.WebReference.callbacktypeoptions.HTTPGET;
if (cpLatestBrief != null)
{
try
{
//MessageBox.Show("You must enter a name.", "Name Entry Error",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
cpLatestBrief.SoapSendSms(destarr,"orig",messagetext.Text,testwebserv1.WebReference.mtype.text,"2",dt,false,cbe,out creditsused,out outdesr);
MessageBox.Show(creditsused, "Credits used",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
catch(SoapHeaderException e)
{
MessageBox.Show(e.Message, "Authentication error",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
catch(SoapException e)
{
System.Xml.XmlNode node = e.Detail;
string errorcode = e.Detail.FirstChild.InnerText;
string errortext = e.Detail.FirstChild.NextSibling.InnerText;
if(errorcode == "DESTERROR-INVALIDNUMBERS")
MessageBox.Show(e.Message, "Name Entry Error",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else if(errorcode == "MESSAGE-NOTSUPPLIED")
MessageBox.Show(e.Message, "Name Entry Error",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else
MessageBox.Show(errorcode+e.Message+" "+errortext, "Name Entry Error",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
return;
}
else
return;
}
Looking at the example, what do I need to do/change to get it working with the Class?
Sorry if this is a lame question, but I'm new to C# Classes.
Regards