views:

16

answers:

1

Hello,

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

A: 

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

Greg