3

What I'd like to do is sending a HTTP POST request to a REST webservice. However it seems as if my applicaion cannot connect to the host. The application throws the following exception when sending the request:

10-19 18:54:05.335: VERBOSE/SD(280): java.net.UnknownHostException: http://www.myhost.com
10-19 18:54:05.335: VERBOSE/SD(280):     at java.net.InetAddress.lookupHostByName(InetAddress.java:513)
10-19 18:54:05.335: VERBOSE/SD(280):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:280)
10-19 18:54:05.335: VERBOSE/SD(280):     at java.net.InetAddress.getByName(InetAddress.java:310)

The host definitely exists and the URL provided is correct. Also I'm able calling the URL using the browser of the Android emulator. The application contains the following in the AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />

Has anybody ever experienced something similar?

Greetings, Robert

1
  • thank you mad my day... I was about to jump from my office building coz of this exception... I am real Idiot forgot to add permission! Commented Oct 23, 2012 at 10:04

1 Answer 1

4

You seem to be using the uri raw as the host. Instead of http://www.myhost.com, simply use www.myhost.com.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.