Server Error: [object XMLHttpRequestProgressEvent] when calling a HTTP REST from the device iphone 6

Hi together,

maybe someone already solved this problem. I’m testing my application and I have started with the iOS simulator for iphone 6 everything work fine and also HTTP Rest calls to my rest backend server.

But when I’m trying to test the same application directly on the iphone 6 or ipad 2 devices, I got this error, that I’m trying to solve.

2017-04-10 02:54:34.608463+0200 mobile-app-sender[867:308803] Ionic Native: deviceready event fired after 2885 ms
2017-04-10 02:54:34.648038+0200 mobile-app-sender[867:308803] ERROR: Server Error: [object XMLHttpRequestProgressEvent]

http://127.0.0.1:9080/myapp/rest/api/v1//conversion_table Failed to load resource: Could not connect to the server.

To be sure I have tried the url: http://127.0.0.1:9080/myapp/rest/api/v1//conversion_table in Safari browser and I got the right data and answer back from the server.

I would appreciate it if you could help me to fix this problem.

Thanks in advance
~serge

I know that iOS doesn’t allow apps to POST without TLS, but not sure about GET. If you don’t get any better answers, try switching to only using https: endpoints.

Does your server receive a request? Does is answer? What does it answer?
(Use the network view of dev tools to find out if you can’t look into the server itself)

I found the cause of this problem:

  • changing the 127.0.0.1 with computer IP address solves the problem.
1 Like

I got the same issue when I called the get method. please help me out

my code is:
var link =‘http://192.168.0.114/Service1.svc/GetLoginDetails/?Username=’ + EmpID + ‘&?Password=’ + password +’&?UDID=’+this.device.uuid + ‘&?Key=as23jk8410bnmklivvui’;

or

      var link ='http://192.168.0.114:81/Service1.svc/GetLoginDetails/?Username=' + EmpID + '&?Password=' + password +'&?UDID='+this.device.uuid + '&?Key=as23jk8410bnmklivvui';

      let headers = new Headers();
      headers.append('Content-Type', 'application/json');

      this.http.get(link).map(res => res.json()).subscribe(data => {
        alert("inside response")
             alert(data.GetLoginDetailsResult.Result);
            if (data.GetLoginDetailsResult.Username != undefined && data.GetLoginDetailsResult.Username !="") {
              this.sqlite.create({
                name: 'employeeDetails.db',
                location: 'default'
                })
                .then((db: SQLiteObject) => {
                  db.executeSql('CREATE TABLE IF NOT EXISTS user_detail(id INTEGER PRIMARY KEY AUTOINCREMENT,emp_id text,password text,udid text,name text,email text,phone_no text,designation text)', {})
                  .catch(e => console.log(e)); 
                  db.executeSql('INSERT INTO user_detail(emp_id,password,udid,name,email,phone_no,designation) VALUES(?,?,?,?,?,?,?)', [data.GetLoginDetailsResult.Username,data.GetLoginDetailsResult.Password,data.GetLoginDetailsResult.UDID
                    ,data.GetLoginDetailsResult.FirstName,data.GetLoginDetailsResult.Email,data.GetLoginDetailsResult.Mobile,data.GetLoginDetailsResult.Designation])
                  .catch(e => console.log(e));
                  db.executeSql('select * from user_detail',[]).then((data) => {
          
                    }, (err) => {
                      this.loading.dismiss();
                     alert('Contact developer: '+JSON.stringify(err));
                    // alert('Unable to execute sql: '+JSON.stringify(err));
                    });
                    })
                .catch(e => console.log(JSON.stringify(e)));
                this.loading.dismiss();
              }
              else {
                this.loading.dismiss();
                this.toast.show('Unable to login, check Emp Id and password.', '3000', 'bottom').subscribe(
                  toast => {
                  }); 
              }
             
            }, error => {
              this.loading.dismiss();
              alert("service:"+error.json());
            });

I can’t find out where I’m getting wrong.,
its ruined my time.