}
throw ex;
}
// Create Result
GatewayGetOperationStatusResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new GatewayGetOperationStatusResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element gatewayOperationElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "GatewayOperation");
if (gatewayOperationElement != null) {
Element idElement = XmlUtility.getElementByTagNameNS(gatewayOperationElement, "http://schemas.microsoft.com/windowsazure", "ID");
if (idElement != null) {
String idInstance;
idInstance = idElement.getTextContent();
result.setId(idInstance);
}
Element statusElement = XmlUtility.getElementByTagNameNS(gatewayOperationElement, "http://schemas.microsoft.com/windowsazure", "Status");
if (statusElement != null) {
GatewayOperationStatus statusInstance;
statusInstance = GatewayOperationStatus.valueOf(statusElement.getTextContent());
result.setStatus(statusInstance);
}
Element httpStatusCodeElement = XmlUtility.getElementByTagNameNS(gatewayOperationElement, "http://schemas.microsoft.com/windowsazure", "HttpStatusCode");
if (httpStatusCodeElement != null) {
Integer httpStatusCodeInstance;
httpStatusCodeInstance = Integer.valueOf(httpStatusCodeElement.getTextContent());
result.setHttpStatusCode(httpStatusCodeInstance);
}
Element errorElement = XmlUtility.getElementByTagNameNS(gatewayOperationElement, "http://schemas.microsoft.com/windowsazure", "Error");
if (errorElement != null) {
GatewayGetOperationStatusResponse.ErrorDetails errorInstance = new GatewayGetOperationStatusResponse.ErrorDetails();
result.setError(errorInstance);
Element codeElement = XmlUtility.getElementByTagNameNS(errorElement, "http://schemas.microsoft.com/windowsazure", "Code");
if (codeElement != null) {
String codeInstance;
codeInstance = codeElement.getTextContent();
errorInstance.setCode(codeInstance);
}
Element messageElement = XmlUtility.getElementByTagNameNS(errorElement, "http://schemas.microsoft.com/windowsazure", "Message");
if (messageElement != null) {
String messageInstance;
messageInstance = messageElement.getTextContent();
errorInstance.setMessage(messageInstance);
}
}
}
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);
}