protected void executeRequest(CredentialProvider provider, String serviceUrl,String requestBody) throws Exception {
// setActionStatus(ACTION_STATUS_NONE);
// setAxlResponse("");
String sMsg;
String sErrPfx = "ArcIMS Service Communication Error: ";
HttpClientRequest httpClient = new HttpClientRequest();
// send the request
try {
httpClient.setCredentialProvider(provider);
httpClient.setUrl(serviceUrl);
// httpClient.setTimeoutMillisecs(service.getTimeoutMillisecs());
httpClient.setMethodName(MethodName.POST);
// httpClient.setAxlRequest(getAxlRequest());
StringProvider cprov = new StringProvider(requestBody,"text/xml");
httpClient.setContentProvider(cprov);
StringHandler sh = new StringHandler();
httpClient.setContentHandler(sh);
httpClient.execute();
// setAxlResponse(httpClient.getAxlResponse());
int nHttpResponseCode = httpClient.getResponseInfo().getResponseCode();
if ((nHttpResponseCode < 200) || (nHttpResponseCode > 299)) {
throw new IOException("Request failed: HTTP "+nHttpResponseCode);
}
} catch (MalformedURLException em) {
// setActionStatus(ACTION_STATUS_ERROR);
sMsg = sErrPfx+"The PublishServer was configured with a malformed URL";
throw new ImsServiceException(sMsg,em);
} catch (UnknownHostException eu) {
// setActionStatus(ACTION_STATUS_ERROR);
sMsg = sErrPfx+"The PublishServer was configured with an unknown host";
throw new ImsServiceException(sMsg,eu);
} catch (Exception e) {
// setActionStatus(ACTION_STATUS_ERROR);
int nHttpResponseCode = httpClient.getResponseInfo().getResponseCode();
if (nHttpResponseCode == 0) {
sMsg = Val.chkStr(e.getMessage());
sMsg = sErrPfx+sMsg;
throw new ImsServiceException(sMsg,e);
} else {
sMsg = sErrPfx+"[HTTP "+nHttpResponseCode+"] "+httpClient.getResponseInfo().getResponseMessage();
throw new ImsServiceException(sMsg,e);
}
}
String response = httpClient.readResponseAsCharacters();
// parse the response
if (response.length() == 0) {
throw new Exception(sErrPfx+"Empty response.");
} else {