}
throw ex;
}
// Create Result
ServerFarmListResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new ServerFarmListResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element serverFarmsSequenceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "ServerFarms");
if (serverFarmsSequenceElement != null) {
for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(serverFarmsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ServerFarm").size(); i1 = i1 + 1) {
org.w3c.dom.Element serverFarmsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(serverFarmsSequenceElement, "http://schemas.microsoft.com/windowsazure", "ServerFarm").get(i1));
ServerFarmListResponse.ServerFarm serverFarmInstance = new ServerFarmListResponse.ServerFarm();
result.getServerFarms().add(serverFarmInstance);
Element currentNumberOfWorkersElement = XmlUtility.getElementByTagNameNS(serverFarmsElement, "http://schemas.microsoft.com/windowsazure", "CurrentNumberOfWorkers");
if (currentNumberOfWorkersElement != null) {
int currentNumberOfWorkersInstance;
currentNumberOfWorkersInstance = DatatypeConverter.parseInt(currentNumberOfWorkersElement.getTextContent());
serverFarmInstance.setCurrentNumberOfWorkers(currentNumberOfWorkersInstance);
}
Element currentWorkerSizeElement = XmlUtility.getElementByTagNameNS(serverFarmsElement, "http://schemas.microsoft.com/windowsazure", "CurrentWorkerSize");
if (currentWorkerSizeElement != null) {
ServerFarmWorkerSize currentWorkerSizeInstance;
currentWorkerSizeInstance = ServerFarmWorkerSize.valueOf(currentWorkerSizeElement.getTextContent());
serverFarmInstance.setCurrentWorkerSize(currentWorkerSizeInstance);
}
Element nameElement = XmlUtility.getElementByTagNameNS(serverFarmsElement, "http://schemas.microsoft.com/windowsazure", "Name");
if (nameElement != null) {
String nameInstance;
nameInstance = nameElement.getTextContent();
serverFarmInstance.setName(nameInstance);
}
Element numberOfWorkersElement = XmlUtility.getElementByTagNameNS(serverFarmsElement, "http://schemas.microsoft.com/windowsazure", "NumberOfWorkers");
if (numberOfWorkersElement != null) {
int numberOfWorkersInstance;
numberOfWorkersInstance = DatatypeConverter.parseInt(numberOfWorkersElement.getTextContent());
serverFarmInstance.setNumberOfWorkers(numberOfWorkersInstance);
}
Element workerSizeElement = XmlUtility.getElementByTagNameNS(serverFarmsElement, "http://schemas.microsoft.com/windowsazure", "WorkerSize");
if (workerSizeElement != null) {
ServerFarmWorkerSize workerSizeInstance;
workerSizeInstance = ServerFarmWorkerSize.valueOf(workerSizeElement.getTextContent());
serverFarmInstance.setWorkerSize(workerSizeInstance);
}
Element statusElement = XmlUtility.getElementByTagNameNS(serverFarmsElement, "http://schemas.microsoft.com/windowsazure", "Status");
if (statusElement != null) {
ServerFarmStatus statusInstance;
statusInstance = ServerFarmStatus.valueOf(statusElement.getTextContent());
serverFarmInstance.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);
}