Restful client question


Last Updated:

  1. bliink

    bliink New Member This Topic's Starter

    Joined:
    Feb 8, 2010
    Messages:
    2
    Likes Received:
    0
    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 This Topic's Starter

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

Share This Page

Loading...