}
throw ex;
}
// Create Result
ServerFarmCreateResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new ServerFarmCreateResponse();
DocumentBuilderFactory documentBuilderFactory2 = DocumentBuilderFactory.newInstance();
documentBuilderFactory2.setNamespaceAware(true);
DocumentBuilder documentBuilder2 = documentBuilderFactory2.newDocumentBuilder();
Document responseDoc = documentBuilder2.parse(new BOMInputStream(responseContent));
Element serverFarmElement2 = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "ServerFarm");
if (serverFarmElement2 != null) {
Element currentNumberOfWorkersElement2 = XmlUtility.getElementByTagNameNS(serverFarmElement2, "http://schemas.microsoft.com/windowsazure", "CurrentNumberOfWorkers");
if (currentNumberOfWorkersElement2 != null) {
int currentNumberOfWorkersInstance;
currentNumberOfWorkersInstance = DatatypeConverter.parseInt(currentNumberOfWorkersElement2.getTextContent());
result.setCurrentNumberOfWorkers(currentNumberOfWorkersInstance);
}
Element currentWorkerSizeElement2 = XmlUtility.getElementByTagNameNS(serverFarmElement2, "http://schemas.microsoft.com/windowsazure", "CurrentWorkerSize");
if (currentWorkerSizeElement2 != null) {
ServerFarmWorkerSize currentWorkerSizeInstance;
currentWorkerSizeInstance = ServerFarmWorkerSize.valueOf(currentWorkerSizeElement2.getTextContent());
result.setCurrentWorkerSize(currentWorkerSizeInstance);
}
Element nameElement2 = XmlUtility.getElementByTagNameNS(serverFarmElement2, "http://schemas.microsoft.com/windowsazure", "Name");
if (nameElement2 != null) {
String nameInstance;
nameInstance = nameElement2.getTextContent();
result.setName(nameInstance);
}
Element numberOfWorkersElement2 = XmlUtility.getElementByTagNameNS(serverFarmElement2, "http://schemas.microsoft.com/windowsazure", "NumberOfWorkers");
if (numberOfWorkersElement2 != null) {
int numberOfWorkersInstance;
numberOfWorkersInstance = DatatypeConverter.parseInt(numberOfWorkersElement2.getTextContent());
result.setNumberOfWorkers(numberOfWorkersInstance);
}
Element workerSizeElement2 = XmlUtility.getElementByTagNameNS(serverFarmElement2, "http://schemas.microsoft.com/windowsazure", "WorkerSize");
if (workerSizeElement2 != null) {
ServerFarmWorkerSize workerSizeInstance;
workerSizeInstance = ServerFarmWorkerSize.valueOf(workerSizeElement2.getTextContent());
result.setWorkerSize(workerSizeInstance);
}
Element statusElement2 = XmlUtility.getElementByTagNameNS(serverFarmElement2, "http://schemas.microsoft.com/windowsazure", "Status");
if (statusElement2 != null) {
ServerFarmStatus statusInstance;
statusInstance = ServerFarmStatus.valueOf(statusElement2.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);
}