user3328: I am trying to call a HTTP GET using my Arduino via SIM900A.
When I run the commands manually via the USB port, I am able to get the commands to run. Now, when I put the same sequence on arduino, the setup() is called repeatedly after the sendATcommand(httpAuthCommand, "OK", 2000);. Looks like a reset issue.
I read, this link to put all my code into loop to avoid the setup() reset issue. But seems like this is did not fix the issue.
I have debugged it to this one change.
This Works
char httpAuthCommand[] = "AT+HTTPPARA=\"URL\",\"http://www.m2msupport.net/m2msupport/http_get_test.php\"" ;

This Does Not work
char httpAuthCommand[] = "AT+HTTPPARA=\"URL\",\"http://1.1.1.1:8080/mytomcatservice/mypath/mycommand/Request?identity=%2B1234567890&identityType=1\"" ;

I debugged this a bit more, it does not work when I add ?identity=%2B0123456789&identityType=1 to the httpAuthCommand. Something crazy while sending parameters ??
In loop()
sendATcommand(httpAuthCommand, "OK", 2000); 

sendATcommand method
int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout){

    uint8_t x=0,  answer=0;
    char response[100];
    unsigned long previous;
    memset(response, '\0', 100);    // Initialice the string
    delay(100);
    while( Serial.available() > 0) Serial.read();    // Clean the input buffer
    Serial.println(ATcommand);    // Send the AT command 
    x = 0;
    previous = millis();
    // this loop waits for the answer
    do{
        // if there are data in the UART input buffer, reads it and checks for the asnwer
        if(Serial.available() != 0){    
            response[x] = Serial.read();
            x++;
            // check if the desired answer is in the response of the module
            if (strstr(response, expected_answer) != NULL)    
            {
                answer = 1;
            }
        }
    // Waits for the asnwer with time out
    }while((answer == 0) && ((millis() - previous) < timeout));    

    return answer;
}

Raw commands work on Chrome

http://www.m2msupport.net/m2msupport/http_get_test.php 
http://1.1.1.1:8080/mytomcatservice/mypath/mycommand/Request?identity=%2B918177900460&identityType=1

My Guess
I am missing some escape sequence characters in the command (especially in the parameters section ?identity=%2B0123456789&identityType=1).

user7991: "Something crazy while sending parameters ??"
Possibly your power supply is to weak so 5V drops low and the processor resets when the transmitter sends a message.

user313: Could you have exceeded the rather limited RAM?
First experiment: Replace the added string with "xxx....x". If you have the same problem, then it's not the contents of the string but its length.
Second experiment (or jump straight to this one): Compile your strings in flash instead of in RAM. Note this will only help if you have a number of them, since your code will have to copy each one to RAM (at run-time) in order to use it, taking up some of the space you had saved. If there is only one string moved to flash, your code will need a temporary buffer of equal size (though only during the actual print call). A possible way around this is to break up the long string into a number of short ones, put all of them in flash, then print them sequentially at run time. That will need a buffer only as large as your largest substring. The cost will be increased use of flash, both for string storage and for the extra number of print calls; and slightly slower execution (probably not an issue).
This may be telling you that you need a more capable processor (one with more RAM space) or that you need to start getting creative about fitting your application into the one you've got.

3328: <p>I am trying to call a HTTP GET using my Arduino via SIM900A.</p>

<p>When I run the commands manually via the USB port, I am able to get the commands to run. Now, when I put the same sequence on arduino, the <code>setup()</code> is called repeatedly after the <code>sendATcommand(httpAuthCommand, "OK", 2000);</code>. Looks like a reset issue.</p>

<p>I read, this link to put all my code into <code>loop</code> to avoid the <code>setup()</code> reset issue. But seems like this is did not fix the issue.</p>

<p>I have debugged it to this one change.</p>

<p><strong>This Works</strong></p>

<pre><code>char httpAuthCommand[] = "AT+HTTPPARA=\"URL\",\"http://www.m2msupport.net/m2msupport/http_get_test.php\"" ;
</code></pre>

<p><strong>This Does Not work</strong></p>

<pre><code>char httpAuthCommand[] = "AT+HTTPPARA=\"URL\",\"http://1.1.1.1:8080/mytomcatservice/mypath/mycommand/Request?identity=%2B1234567890&amp;identityType=1\"" ;
</code></pre>

<p>I debugged this a bit more, it does not work when I add <code>?identity=%2B0123456789&amp;identityType=1</code> to the httpAuthCommand. Something crazy while sending parameters ??</p>

<p><strong>In loop()</strong></p>

<pre><code>sendATcommand(httpAuthCommand, "OK", 2000); 
</code></pre>

<p><strong>sendATcommand method</strong></p>

<pre><code>int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout){

    uint8_t x=0,  answer=0;
    char response[100];
    unsigned long previous;
    memset(response, '\0', 100);    // Initialice the string
    delay(100);
    while( Serial.available() &gt; 0) Serial.read();    // Clean the input buffer
    Serial.println(ATcommand);    // Send the AT command 
    x = 0;
    previous = millis();
    // this loop waits for the answer
    do{
        // if there are data in the UART input buffer, reads it and checks for the asnwer
        if(Serial.available() != 0){    
            response[x] = Serial.read();
            x++;
            // check if the desired answer is in the response of the module
            if (strstr(response, expected_answer) != NULL)    
            {
                answer = 1;
            }
        }
    // Waits for the asnwer with time out
    }while((answer == 0) &amp;&amp; ((millis() - previous) &lt; timeout));    

    return answer;
}
</code></pre>

<p>Raw commands work on Chrome</p>

<blockquote>
  <p><a href="http://www.m2msupport.net/m2msupport/http_get_test.php" rel="nofollow">http://www.m2msupport.net/m2msupport/http_get_test.php</a> </p>
  
  <p><a href="http://1.1.1.1:8080/mytomcatservice/mypath/mycommand/Request?identity=%2B918177900460&amp;identityType=1" rel="nofollow">http://1.1.1.1:8080/mytomcatservice/mypath/mycommand/Request?identity=%2B918177900460&amp;identityType=1</a></p>
</blockquote>

<p><strong>My Guess</strong></p>

<p>I am missing some escape sequence characters in the command (especially in the parameters section <code>?identity=%2B0123456789&amp;identityType=1</code>).</p>
 7991: <p>"Something crazy while sending parameters ??"</p>

<p>Possibly your power supply is to weak so 5V drops low and the processor resets when the transmitter sends a message.</p>
 313: <p>Could you have exceeded the rather limited RAM?
First experiment: Replace the added string with "xxx....x". If you have the same problem, then it's not the contents of the string but its length.
Second experiment (or jump straight to this one): <a href="http://www.arduino.cc/en/Serial/Print" rel="nofollow">Compile your strings in flash</a> instead of in RAM. Note this will only help if you have a number of them, since your code will have to copy each one to RAM (at run-time) in order to use it, taking up some of the space you had saved. If there is only one string moved to flash, your code will need a temporary buffer of equal size (though only during the actual print call). A possible way around this is to break up the long string into a number of short ones, put all of them in flash, then print them sequentially at run time. That will need a buffer only as large as your largest substring. The cost will be increased use of flash, both for string storage and for the extra number of print calls; and slightly slower execution (probably not an issue).</p>

<p>This may be telling you that you need a more capable processor (one with more RAM space) or that you need to start getting creative about fitting your application into the one you've got.</p>
