}
throw ex;
}
// Create Result
CloudServiceGetResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new CloudServiceGetResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element cloudServiceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "CloudService");
if (cloudServiceElement != null) {
Element geoLocationElement = XmlUtility.getElementByTagNameNS(cloudServiceElement, "http://schemas.microsoft.com/windowsazure", "GeoLocation");
if (geoLocationElement != null) {
String geoLocationInstance;
geoLocationInstance = geoLocationElement.getTextContent();
result.setGeoLocation(geoLocationInstance);
}
Element resourcesSequenceElement = XmlUtility.getElementByTagNameNS(cloudServiceElement, "http://schemas.microsoft.com/windowsazure", "Resources");
if (resourcesSequenceElement != null) {
for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(resourcesSequenceElement, "http://schemas.microsoft.com/windowsazure", "Resource").size(); i1 = i1 + 1) {
org.w3c.dom.Element resourcesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(resourcesSequenceElement, "http://schemas.microsoft.com/windowsazure", "Resource").get(i1));
CloudServiceGetResponse.Resource resourceInstance = new CloudServiceGetResponse.Resource();
result.getResources().add(resourceInstance);
Element resourceProviderNamespaceElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "ResourceProviderNamespace");
if (resourceProviderNamespaceElement != null) {
String resourceProviderNamespaceInstance;
resourceProviderNamespaceInstance = resourceProviderNamespaceElement.getTextContent();
resourceInstance.setResourceProviderNamespace(resourceProviderNamespaceInstance);
}
Element typeElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "Type");
if (typeElement != null) {
String typeInstance;
typeInstance = typeElement.getTextContent();
resourceInstance.setType(typeInstance);
}
Element eTagElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "ETag");
if (eTagElement != null) {
String eTagInstance;
eTagInstance = eTagElement.getTextContent();
resourceInstance.setETag(eTagInstance);
}
Element schemaVersionElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "SchemaVersion");
if (schemaVersionElement != null) {
String schemaVersionInstance;
schemaVersionInstance = schemaVersionElement.getTextContent();
resourceInstance.setSchemaVersion(schemaVersionInstance);
}
Element nameElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "Name");
if (nameElement != null) {
String nameInstance;
nameInstance = nameElement.getTextContent();
resourceInstance.setName(nameInstance);
}
Element planElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "Plan");
if (planElement != null) {
String planInstance;
planInstance = planElement.getTextContent();
resourceInstance.setPlan(planInstance);
}
Element outputItemsSequenceElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "OutputItems");
if (outputItemsSequenceElement != null) {
for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(outputItemsSequenceElement, "http://schemas.microsoft.com/windowsazure", "OutputItem").size(); i2 = i2 + 1) {
org.w3c.dom.Element outputItemsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(outputItemsSequenceElement, "http://schemas.microsoft.com/windowsazure", "OutputItem").get(i2));
String outputItemsKey = XmlUtility.getElementByTagNameNS(outputItemsElement, "http://schemas.microsoft.com/windowsazure", "Key").getTextContent();
String outputItemsValue = XmlUtility.getElementByTagNameNS(outputItemsElement, "http://schemas.microsoft.com/windowsazure", "Value").getTextContent();
resourceInstance.getOutputItems().put(outputItemsKey, outputItemsValue);
}
}
Element stateElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "State");
if (stateElement != null) {
String stateInstance;
stateInstance = stateElement.getTextContent();
resourceInstance.setState(stateInstance);
}
Element subStateElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "SubState");
if (subStateElement != null) {
String subStateInstance;
subStateInstance = subStateElement.getTextContent();
resourceInstance.setSubState(subStateInstance);
}
Element labelElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "Label");
if (labelElement != null) {
String labelInstance;
labelInstance = labelElement.getTextContent();
resourceInstance.setLabel(labelInstance);
}
}
}
}
result.setStatusCode(statusCode);
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}
return result;