Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Local tomcat sends Json strings well to an Android application while remote server doesn't.  RSS feed

Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I have an Android application which send strings, and get strings from a tomcat server.
When I run Tomcat in my local machine: the job gets done and everything works well.
When I run tomcat in remote server, things from the server are being sent to the application except  the JSON strings.

I will try to show you an example.

This is a code in an Android application that SENDS string to the web application in the remote server (The Tomcat). It works fine!

works well ! no problem to send (I verified by the console output - it is being send) and reaching the right place.

This is a code in an WEB application in the remote server (The Tomcat), that SENDS string back to the Android  application (After quering the DB and got an answer. I verified of course it has the right answer from the DBand it has).
Not any Error with this part neither.


Now, This  is the Android application which suppose to get the answer  from the server:

Here is the problem:  the second row will throw java.lang.NumberFormatException invalid int "null"
becaue id didn't recieve anything from the Server.

Here is the strange part: When the same code is running vs the local server it works.
When it is running vs remote server it doesn't work.
No Errors but the Sending from Tomcat to the Application, doesn't arrive when JSON is involved (I guess it has something with the way of sending:  "response.getOutputStream().write(output.getBytes());"
that the server forbid, but I really don't know. it just doesn't send (without any error).

when I send send from the server a simple string this way:

it works fine.


Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!