}
throw ex;
}
// Create Result
ServerFarmGetResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new ServerFarmGetResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element serverFarmElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "ServerFarm");
if (serverFarmElement != null) {
Element currentNumberOfWorkersElement = XmlUtility.getElementByTagNameNS(serverFarmElement, "http://schemas.microsoft.com/windowsazure", "CurrentNumberOfWorkers");
if (currentNumberOfWorkersElement != null) {
int currentNumberOfWorkersInstance;
currentNumberOfWorkersInstance = DatatypeConverter.parseInt(currentNumberOfWorkersElement.getTextContent());
result.setCurrentNumberOfWorkers(currentNumberOfWorkersInstance);
}
Element currentWorkerSizeElement = XmlUtility.getElementByTagNameNS(serverFarmElement, "http://schemas.microsoft.com/windowsazure", "CurrentWorkerSize");
if (currentWorkerSizeElement != null) {
ServerFarmWorkerSize currentWorkerSizeInstance;
currentWorkerSizeInstance = ServerFarmWorkerSize.valueOf(currentWorkerSizeElement.getTextContent());
result.setCurrentWorkerSize(currentWorkerSizeInstance);
}
Element nameElement = XmlUtility.getElementByTagNameNS(serverFarmElement, "http://schemas.microsoft.com/windowsazure", "Name");
if (nameElement != null) {
String nameInstance;
nameInstance = nameElement.getTextContent();
result.setName(nameInstance);
}
Element numberOfWorkersElement = XmlUtility.getElementByTagNameNS(serverFarmElement, "http://schemas.microsoft.com/windowsazure", "NumberOfWorkers");
if (numberOfWorkersElement != null) {
int numberOfWorkersInstance;
numberOfWorkersInstance = DatatypeConverter.parseInt(numberOfWorkersElement.getTextContent());
result.setNumberOfWorkers(numberOfWorkersInstance);
}
Element workerSizeElement = XmlUtility.getElementByTagNameNS(serverFarmElement, "http://schemas.microsoft.com/windowsazure", "WorkerSize");
if (workerSizeElement != null) {
ServerFarmWorkerSize workerSizeInstance;
workerSizeInstance = ServerFarmWorkerSize.valueOf(workerSizeElement.getTextContent());
result.setWorkerSize(workerSizeInstance);
}
Element statusElement = XmlUtility.getElementByTagNameNS(serverFarmElement, "http://schemas.microsoft.com/windowsazure", "Status");
if (statusElement != null) {
ServerFarmStatus statusInstance;
statusInstance = ServerFarmStatus.valueOf(statusElement.getTextContent());
result.setStatus(statusInstance);
}
}
result.setStatusCode(statusCode);
if (httpResponse.getHeaders("x-ms-request-id").length > 0) {
result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue());
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}