httpread failed to read full data

#include<SoftwareSerial.h>
SoftwareSerial myGsm(9, 10);

void setup() {
myGsm.begin(9600);
Serial.begin(9600);
delay(2000);
myGsm.println("AT+CGATT=1\r");
delay(2000);
printSerialData();
myGsm.println("AT+SAPBR=3,1,"APN","idea_Internet"\r");
delay(2000);
printSerialData();
myGsm.println("AT+SAPBR=1,1\r");
delay(2000);
printSerialData();
myGsm.println("AT+SAPBR=2,1\r");
delay(2000);
printSerialData();
myGsm.println("AT+HTTPINIT\r");
delay(2000);
printSerialData();
myGsm.println("AT+HTTPPARA="CID",1\r");
delay(2000);
printSerialData();
//myGsm.println("AT+HTTPPARA="URL","https://api.thingspeak.com/apps/thinghttp/send_request?api_key=6B1GS2XKAO2MS3SK\"");
myGsm.println("AT+HTTPPARA="URL","http://ge.1zu.in/txn/GE011/D001/out\"");
delay(2000);
printSerialData();
myGsm.println("AT+HTTPACTION=0\r");
delay(5000);
printSerialData();
myGsm.println("AT+HTTPREAD\r");
delay(2000);
printSerialDataa();
//myGsm.println();
delay(2000);
Serial.println("Over");
myGsm.println("AT+HTTPTERM");
printSerialData();
}

void loop() {
// put your main code here, to run repeatedly:

}
void printSerialData()
{
//Serial.println("loop");
// delay(2000);
while (myGsm.available() > 0)
{
char ch = myGsm.read();
Serial.write(ch);
}
}
void printSerialDataa()
{
//Serial.println("loop");
delay(2000);
while (myGsm.available() > 0)
{
char ch = myGsm.read();
Serial.write(ch);
}
}

//at commands ands respons
AT+CGATT=1

OK
AT+SAPBR=3,1,"APN","idea_Internet"

OK
AT+SAPBR=1,1

ERROR
AT+SAPBR=2,1

+SAPBR: 1,1,"100.79.14.178"

OK
AT+HTTPINIT

OK
AT+HTTPPARA="CID",1

OK
AT+HTTPPARA="URL","http://ge.1zu.in/txn/GE011/D001/out"

OK
AT+HTTPACTION=0

OK

+HTTPACTION:0,200,227
AT+HTTPREAD

+HTTPREAD:227
{"type":true,"data":[{"_id":"56bOver

//actual data is
{"type":true,"data":[{"_id":"56bdc6ca1e07595c0d4540f0","details":"mac0012344","deviceObject":"56c175ee09031beb931cfb11","facilityObject":"56c1751b09031beb931cfb10","workstationId":"001"}],"msg":"Transaction saved Successfully"}

How long is it between the time you send the commands and the time you read the responses? What is the likelihood that you have overflowed the serial buffer?

What is the likelihood that all the serial data has yet to arrive when you quit reading?

Why is the code you posted full of commented out crap? The commented out crap is NOT the problem, so do not post the commented out crap.

Sorry for posting the commented stuff!

As you can see some data is missing is there any problem with the code?
Could you please help me to fix it?

#include<SoftwareSerial.h>
SoftwareSerial myGsm(9, 10);
unsigned char buffer[64];
int count=0;
void setup() {
myGsm.begin(9600);
Serial.begin(9600);
delay(2000);
myGsm.println("AT+CGATT=1\r");
delay(2000);
printSerialData();
myGsm.println("AT+SAPBR=3,1,"APN","idea_Internet"\r");
delay(2000);
printSerialData();
myGsm.println("AT+SAPBR=1,1\r");
delay(2000);
printSerialData();
myGsm.println("AT+SAPBR=2,1\r");
delay(2000);
printSerialData();
myGsm.println("AT+HTTPINIT\r");
delay(2000);
printSerialData();
myGsm.println("AT+HTTPPARA="CID",1\r");
delay(2000);
printSerialData();
myGsm.println("AT+HTTPPARA="URL","http://ge.1zu.in/txn/GE011/D001/out\"");
delay(2000);
printSerialData();
myGsm.println("AT+HTTPACTION=0\r");
delay(5000);
printSerialData();
myGsm.println("AT+HTTPREAD\r");
delay(300);
printSerialData();
delay(2000);
Serial.println("Over");
myGsm.println("AT+HTTPTERM");
printSerialData();
}

void loop() {
// put your main code here, to run repeatedly:

}

void printSerialData()
{
while (myGsm.available() > 0)
{
char ch = myGsm.read();
Serial.write(ch);
}
}

Please use code tags when posting code; you can edit both your posts

Type
** **[code]** **
before the code
Type
** **[/code]** **
after the code

It will be displayed in a scrolling window making it easier to read and copy and there is no risk of corrupted displaying of the code.

Try this and see if you get all of the data (keep the rest of the code the same, just change the loop function):

void loop() {
  // put your main code here, to run repeatedly:
  printSerialData();
}

As you can see some data is missing is there any problem with the code?

Yes, there is. You ASSume that all the reply data will arrive at once. It most certainly will NOT.

Could you please help me to fix it?

Not until you understand that serial data transmission is:

  1. asynchronous
  2. slow

You have written ALL of your code to try to circumvent item 1, and to ASSume that 2 is not true.

If you are going to try to force the serial process to be synchronous, you can NOT rely on delay() pissing away just enough time so that a complete response has been received before you try to read it, AND you can NOT mix asynchronous sends with synchronous sends and receives. Either you care about the response from EVERY command, or you don't care about the response from ANY command.