Error in iSMS

Home Forums General Error in iSMS

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #15942
    Alejandro Munoz
    Participant

    Hello,

    Im working in a windows service using VS2012, but there is an error when I send the request (im sending this “http://192.168.2.1:5000/querymsg?user=admin&passwd=admin&apimsgid=0”). This is my code:

    HttpWebRequest oHttpRequest = (HttpWebRequest)WebRequest.Create(strUrl);
    HttpWebResponse oHttpResponse = (HttpWebResponse)oHttpRequest.GetResponse();

    The second line throw this exception:

    “The server committed a protocol violation. Section=ResponseStatusLine”

    #15995
    Bryon Davis
    Moderator

    Hi Alejandro,
    There are some examples available on our FTP site at https://webfiles.multitech.com/engineering/sample-code/sms-finder/ which may be some help. Your code looks close to my example (see below), so it isn’t obvious why it’s failing.

    Make sure that “HTTP API Status” is enabled in the “SMS API” menu and that the port is set to the correct value.

    Try the example code at https://webfiles.multitech.com/engineering/sample-code/sms-finder/c-sharp/iSMSHTTPQuerymsg/iSMSHTTPQuerymsg.zip and see if that works for you. I tested it this morning and it worked using Visual Studio Express 2015.

    String sendmsg = “http://192.168.2.1:81/querymsg?user=admin&passwd=admin&apimsgid=0”;

    // Next section sends the sendmsg request to iSMS and gets the response.
    try
    {
    // prepare the web page we will be asking for
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(sendmsg);

    // execute the request
    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    // Create a new stream to read from a response
    StreamReader sr = new StreamReader(response.GetResponseStream());
    // Read contents of response into a string
    String responseMsg = sr.ReadToEnd();
    // Close StreamReader
    sr.Close();
    }
    catch (System.Exception e)
    {
    // Exception sending HTTP request, or getting response.
    Console.WriteLine(“Error sending request to iSMS:”);
    Console.WriteLine(e.ToString());
    }

    #16006
    Alejandro Munoz
    Participant

    Thank you!, now is working!!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.