}
throw ex;
}
// Create Result
VirtualMachineOSImageGetResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new VirtualMachineOSImageGetResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element oSImageElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "OSImage");
if (oSImageElement != null) {
Element affinityGroupElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "AffinityGroup");
if (affinityGroupElement != null) {
String affinityGroupInstance;
affinityGroupInstance = affinityGroupElement.getTextContent();
result.setAffinityGroup(affinityGroupInstance);
}
Element categoryElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "Category");
if (categoryElement != null) {
String categoryInstance;
categoryInstance = categoryElement.getTextContent();
result.setCategory(categoryInstance);
}
Element labelElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "Label");
if (labelElement != null) {
String labelInstance;
labelInstance = labelElement.getTextContent();
result.setLabel(labelInstance);
}
Element locationElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "Location");
if (locationElement != null) {
String locationInstance;
locationInstance = locationElement.getTextContent();
result.setLocation(locationInstance);
}
Element logicalSizeInGBElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "LogicalSizeInGB");
if (logicalSizeInGBElement != null) {
double logicalSizeInGBInstance;
logicalSizeInGBInstance = DatatypeConverter.parseDouble(logicalSizeInGBElement.getTextContent());
result.setLogicalSizeInGB(logicalSizeInGBInstance);
}
Element mediaLinkElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "MediaLink");
if (mediaLinkElement != null) {
URI mediaLinkInstance;
mediaLinkInstance = new URI(mediaLinkElement.getTextContent());
result.setMediaLinkUri(mediaLinkInstance);
}
Element nameElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "Name");
if (nameElement != null) {
String nameInstance;
nameInstance = nameElement.getTextContent();
result.setName(nameInstance);
}
Element osElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "OS");
if (osElement != null) {
String osInstance;
osInstance = osElement.getTextContent();
result.setOperatingSystemType(osInstance);
}
Element eulaElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "Eula");
if (eulaElement != null) {
String eulaInstance;
eulaInstance = eulaElement.getTextContent();
result.setEula(eulaInstance);
}
Element descriptionElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "Description");
if (descriptionElement != null) {
String descriptionInstance;
descriptionInstance = descriptionElement.getTextContent();
result.setDescription(descriptionInstance);
}
Element imageFamilyElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "ImageFamily");
if (imageFamilyElement != null) {
String imageFamilyInstance;
imageFamilyInstance = imageFamilyElement.getTextContent();
result.setImageFamily(imageFamilyInstance);
}
Element showInGuiElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "ShowInGui");
if (showInGuiElement != null && (showInGuiElement.getTextContent() == null || showInGuiElement.getTextContent().isEmpty() == true) == false) {
boolean showInGuiInstance;
showInGuiInstance = DatatypeConverter.parseBoolean(showInGuiElement.getTextContent().toLowerCase());
result.setShowInGui(showInGuiInstance);
}
Element publishedDateElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "PublishedDate");
if (publishedDateElement != null) {
Calendar publishedDateInstance;
publishedDateInstance = DatatypeConverter.parseDateTime(publishedDateElement.getTextContent());
result.setPublishedDate(publishedDateInstance);
}
Element isPremiumElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "IsPremium");
if (isPremiumElement != null && (isPremiumElement.getTextContent() == null || isPremiumElement.getTextContent().isEmpty() == true) == false) {
boolean isPremiumInstance;
isPremiumInstance = DatatypeConverter.parseBoolean(isPremiumElement.getTextContent().toLowerCase());
result.setIsPremium(isPremiumInstance);
}
Element iconUriElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "IconUri");
if (iconUriElement != null) {
URI iconUriInstance;
iconUriInstance = new URI(iconUriElement.getTextContent());
result.setIconUri(iconUriInstance);
}
Element privacyUriElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "PrivacyUri");
if (privacyUriElement != null) {
URI privacyUriInstance;
privacyUriInstance = new URI(privacyUriElement.getTextContent());
result.setPrivacyUri(privacyUriInstance);
}
Element recommendedVMSizeElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "RecommendedVMSize");
if (recommendedVMSizeElement != null) {
String recommendedVMSizeInstance;
recommendedVMSizeInstance = recommendedVMSizeElement.getTextContent();
result.setRecommendedVMSize(recommendedVMSizeInstance);
}
Element publisherNameElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "PublisherName");
if (publisherNameElement != null) {
String publisherNameInstance;
publisherNameInstance = publisherNameElement.getTextContent();
result.setPublisherName(publisherNameInstance);
}
Element smallIconUriElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "SmallIconUri");
if (smallIconUriElement != null) {
URI smallIconUriInstance;
smallIconUriInstance = new URI(smallIconUriElement.getTextContent());
result.setSmallIconUri(smallIconUriInstance);
}
Element languageElement = XmlUtility.getElementByTagNameNS(oSImageElement, "http://schemas.microsoft.com/windowsazure", "Language");
if (languageElement != null) {
String languageInstance;
languageInstance = languageElement.getTextContent();
result.setLanguage(languageInstance);
}
}
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);
}