title: Android : 400 Error code when accessing a RESTful webservice
body: <p>I want to access a Restful web service. I want the request should be in the following format.</p>
  
  <pre><code>GET /API/Contacts/username HTTP/1.1 
  HOST: $baseuri:port 
  Accept: text/xml 
  Authorization: Basic ZmF0aWdhYmxlIGdlbmVyYXR=
  </code></pre>
  
  <p>And also I am calling the web service though HTTPS protocol.
  The folowing is the code I am using :</p>
  
  <pre><code>HttpGet get = new HttpGet("https://secure.myapp.com/MyApp/API/Contacts/myname");
  
    get.addHeader("Accept","text/xml");
    get.addHeader("Authorization","Basic ZmF0aWdhYmxlIGdlbmVyYXR=");          
    get.addHeader("Host","https://secure.myapp.com");
    get.addHeader("Connection Use","HTTP 1.1");
  
    DefaultHttpClient client =  new DefaultHttpClient();
    ResponseHandler objHandler = new BasicResponseHandler();
    String getResponse = client.execute(get,objHandler); 
  </code></pre>
  
  <p>But I am getting an Error : 400 Bad request.</p>
  
  <p>I am not sure whether my code is correct. Is it necessary to specify the method (GET, POST or PUT) explicitly in the header?</p>
  
  <p>Please help me...
  Thnking You....</p>