protected String postRallyXML(String apiUrl, String requestXML) throws Exception {
    String responseXML = "";

    DefaultHttpClient httpClient = new DefaultHttpClient();

    Base64 base64 = new Base64();
    String encodeString =
        new String(base64.encode((rallyApiHttpUsername + ":" + rallyApiHttpPassword).getBytes()));

    HttpPost httpPost = new HttpPost(apiUrl);
    httpPost.addHeader("Authorization", "Basic " + encodeString);

    httpPost.setEntity(new StringEntity(requestXML));

    HttpResponse response = httpClient.execute(httpPost);
    HttpEntity entity = response.getEntity();

    responseXML = getEntityString(entity);

    return responseXML;
  }
Beispiel #2
0
 /**
  * send request
  *
  * @param message - corezoid message
  * @return
  * @throws org.apache.http.HttpException
  */
 public String send(CorezoidMessage message) throws HttpException {
   HttpPost post = new HttpPost(message.url);
   post.setEntity(new StringEntity(message.body, jsonUTF8));
   return sendBasic(post);
 }