title: How to make this REST get method in Java?
body: <p>I have the following REST get Request that works successfully:</p>
  
  <p><img src="https://i.stack.imgur.com/K9Aut.png" alt="enter image description here"></p>
  
  <p>The result is a XML document that I then want to parse. I tried the same in Java:</p>
  
  <p>I use the following code:</p>
  
  <pre><code>public void getRootService() throws ClientProtocolException, IOException {
  
      HttpGet httpGet = new HttpGet("https://localhost:9443/ccm/rootservices");
      httpGet.setHeader("Accept", "text/xml");
      HttpResponse response = client.execute(httpGet);
      HttpEntity entity = response.getEntity();
      InputStream in = entity.getContent();
      String projectURL = XMLDocumentParser.parseDocument(in);
  
      System.out.println(projectURL);
      HttpGet getProjectsRequest = new HttpGet("https://localhost:9443/ccm/process/project-areas");
      getProjectsRequest.setHeader("Content-Type", "application/xml;charset=UTF-8");
      getProjectsRequest.setHeader("Accept-Charset", "UTF-8");
      getProjectsRequest.setHeader("Accept", "application/xml");
  
  
      ResponseHandler&lt;String&gt; handler = new BasicResponseHandler();
      String projectResponse = client.execute(getProjectsRequest, handler);
      //String projectResponse = client.execute(getProjectsRequest, handler);
  
      System.out.println(projectResponse);
  
  }
  </code></pre>
  
  <p>But how can I do the authentication? I tried to just add another header field for the value "Authorization" but then I don't get the same result.</p>