• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML response not correct in Java, but correct in browser

 
Marius Vasile
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firs of all I want to say that I was able to read XML response from URL. Thank you for this and many other helps. I read and printed the response (code below) but the result is not correct.

In browser shows me (correct):



And in Java it prints this (incorrect):


How can I get the correct result? Thank you!

My code for getting and printing the response:
Example 1:



Example 2:

 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, hopefully you read Italian better than I do, but what you got appears to say something about sessions and having to log in.

So I suggest that your browser is cooperating with the server in maintaining a session, most likely by receiving and sending a cookie. Your Java code should do the same thing. So first it should go to the login page with the right parameters, and then it should receive a cookie along with the response, and then it should go to the data page, sending the cookie along with the data.

That's just a rough description with a fair amount of guesswork. I suggest you observe the requests and responses when you access the site with your browser, and then write your Java code to send the same requests.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic