Results 1 to 1 of 1

Thread: C# Newbie - Using SOAP to send SMS

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member Pozzi's Avatar
    Join Date
    Feb 2001
    Location
    The Stones!
    Posts
    507

    Post 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:
    1. public void sendansms()
    2. {
    3.  
    4.  string [] destarr = new string[1];
    5.  destarr[0] = "44711111111";
    6.  destarr[1] = "44722222222";
    7.  cpLatestBrief.authValue = new auth();
    8.  cpLatestBrief.authValue.username = "myusername";
    9.  cpLatestBrief.authValue.password = "mypassword";
    10.  string creditsused;// = new string("");
    11.  
    12.  string outdesr;// = new string("");
    13.  
    14.  System.DateTime dt = DateTime.Now;
    15.  testwebserv1.WebReference.callbackelement cbe = new callbackelement();
    16.  cbe.callbackurl = "http://url.com";
    17.  cbe.callbacktype = testwebserv1.WebReference.callbacktypeoptions.HTTPGET;
    18.  if (cpLatestBrief != null)
    19.  {
    20.   try
    21.   {
    22.    //MessageBox.Show("You must enter a name.", "Name Entry Error",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    23.    cpLatestBrief.SoapSendSms(destarr,"orig",messagetext.Text,testwebserv1.WebReference.mtype.text,"2",dt,false,cbe,out creditsused,out outdesr);
    24.    MessageBox.Show(creditsused, "Credits used",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    25.   }
    26.   catch(SoapHeaderException e)
    27.   {
    28.  
    29.    MessageBox.Show(e.Message, "Authentication error",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    30.   }
    31.   catch(SoapException e)
    32.   {
    33.  
    34.    System.Xml.XmlNode node = e.Detail;
    35.  
    36.    string errorcode = e.Detail.FirstChild.InnerText;
    37.    string errortext = e.Detail.FirstChild.NextSibling.InnerText;
    38.  
    39.  
    40.    if(errorcode == "DESTERROR-INVALIDNUMBERS")
    41.     MessageBox.Show(e.Message, "Name Entry Error",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    42.    else if(errorcode == "MESSAGE-NOTSUPPLIED")
    43.     MessageBox.Show(e.Message, "Name Entry Error",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    44.    else
    45.     MessageBox.Show(errorcode+e.Message+"  "+errortext, "Name Entry Error",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    46.   }
    47.   return;
    48.  }
    49.  else
    50.   return;
    51. }

    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
    Attached Files Attached Files
    VB.Net (VS 2010)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width