1
votes

I'm developing an rest api on java 6 because on my work are using Tomcat 6. I have de api point working on Postman but when I try to use it on my Ionic app it returns a wrong type(html instead of json).

enter image description here

Note that any header is supplied

On my Ionic App

enter image description here

Here I'm using the next code:

getPosData():Observable<any>{

let url = this.isProd ? this.urlBaseProd : this.urlBase;
url += "pos/getposall";   

return this.httpClient.get(url);
}

This is my controller

enter image description here

and a generic response class.

enter image description here

My ionic info

✔ Gathering environment info - done!

Ionic:

ionic (Ionic CLI) : 4.2.1 (/home/usuario/.npm-global/lib/node_modules/ionic) Ionic Framework : ionic-angular 3.9.2 @ionic/app-scripts : 3.2.0

Cordova:

cordova (Cordova CLI) : 8.1.2 ([email protected]) Cordova Platforms : android 7.1.2 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 8 other plugins)

System:

Android SDK Tools : 26.1.1 (/home/usuario/Android/Sdk) NodeJS : v8.12.0 (/usr/bin/node) npm : 6.4.1 OS : Linux 4.15

1
I have tested on a ionic app blank just with HttpClient and It's working fine.DavElsanto

1 Answers

0
votes

When I was debbuging I have noticed that ionic cordova run android let app working on localhost:8080 and my war is on the same place. So I decided to deploy my war on pre-production server and all works fine.