thank you very much for the answer but it did not work. I knew about that "localhost" adress but while tinkering around with the code it seems like I overwrote my own changes. Here is the new code:
The behavior is still the same. I only see "Hello, World false" after executing the HTTP Put request via the Android emulator. I am pretty sure I am doing something really stupid here which keeps it from running properly but right now I just do not get it
If you guys need anymore information, I will post it. Just let me know.
Joined: Mar 22, 2005
The PUT call does not seem to execute anything - make sure it actually gets to the server. Calling httpCon.connect() may be sufficient for that, or writing something to the output stream.
as you suggested I added some Sysouts to the code so I can see which methods are called. That gives me:
Result: I can now see in the protocols on the Admin Console that HTTP GET was executing but HTTP PUT is still missing. I attached two screenshots showing that the method on the Android was executed but that only a GET request send from the browser shows up in the logs.
I installed wireshark. It looks really interesting but I am new to it and it gives me way too much information so I am having a hard time filtering and looking for the right stuff. I did not find the HTTP PUT but I am not sure if I am doing it right. Could you point me to the proper way of filtering so it only shows the java HTTP PUT if it is there? Maybe you know how to filter that and can give me an advice? That would be highly appreciated as I tinkered around with it for an hour but could not get the results I wanted.
Altogether I think the call from the Android is not reaching the server at all but I don't get why Would be nice if you could give me some more hints?
Watching the wireshark introduction from their site right now. Hope to understand the filtering soon.
Joined: Mar 22, 2005
Thinking some more about, I'm not actually sure if Wireshark would be able to see HTTP requests between two processes on the same machine. Were you able to see the GET request? If not, I apologize for sending you on a wild goose chase.
What should definitely work is TCPMon. If you run that, say, listening on port 7070 and forwarding to port 8080, it will log all HTTP conversations going on. You'd just have to use port 7070 in your Android code.
Discussing with some firends of mine I got the same idea about the http request and Wireshark today. I will try tcpmon also. But before that: I am on Windows 7 and did not check the firewall so far - I did not install one but forgot that there is one from Microsoft already installed which may block the connection.
I will post the results later.
Thanks for clearing things up as I already started to run in the wrong direction
I finally tried the HTTP POST method:
So, this gives a "204" message but finally shows up in the logs - see attachment. BUT: The GET method through the browser still gives me the "Hello, World false" content - you can see that in the logs attachment also - and I don't get why!?
Can you help? The Post method was called and the variables changed. Any ideas about that? Do I have to write a bean for that or something? Or do I have to save that in a special way - through a ressource on the website - as this is a Rest Webservice? Really like to understand even if Imay get the code up and running now.
Do you think the POST method did not work because the ressource was already there? I read it is only for not existing stuff.
Greetings - and thanks so far as I think I learned a lot through that already... but still have a long way to go...
found the mistake about the PUT method - I always called the GET through the browser to test that the application is running... In my little world i understand: It created the ressource so PUT makes no sense anymore and wassn't called on the server.
Did I interpret that right?
Still I don't get why GET is not returning the changed state when ccalling PUT or POST - hope to figure that out soon. Maybe a little hint?