1. Check out our app, Forums for Android! Download and leave feedback here!

Restful client question

Discussion in 'Application Development' started by bliink, Feb 8, 2010.

  1. bliink

    bliink New Member
    Thread Starter
    5

    Feb 8, 2010
    2
    0
    5
    Im trying to consume a restful service and im getting an error "Host name may not be null". Below is my exact code. If I copy and paste the url that im passing into this function into my browser I get results.

    Thanks in advance for any help.

    public​
    static void connect(String pUrl)
    {

    HttpClient client = new DefaultHttpClient();
    HttpGet httpget =
    new HttpGet(pUrl);

    String result=
    null;
    HttpEntity entity =
    null;
    HttpResponse response;
    try {
    response = client.execute(httpget);
    }
    catch (Exception e) {
    e.printStackTrace();
    }

    }
     

    Advertisement

  2. bliink

    bliink New Member
    Thread Starter
    5

    Feb 8, 2010
    2
    0
    5
    I found the problem. My url had an underscore in it. Underscores are not allowed in host names.
     

Share This Page

Loading...