}
throw ex;
}
// Create Result
HostedServiceGetExtensionResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new HostedServiceGetExtensionResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element extensionElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "Extension");
if (extensionElement != null) {
Element providerNameSpaceElement = XmlUtility.getElementByTagNameNS(extensionElement, "http://schemas.microsoft.com/windowsazure", "ProviderNameSpace");
if (providerNameSpaceElement != null) {
String providerNameSpaceInstance;
providerNameSpaceInstance = providerNameSpaceElement.getTextContent();
result.setProviderNamespace(providerNameSpaceInstance);
}
Element typeElement = XmlUtility.getElementByTagNameNS(extensionElement, "http://schemas.microsoft.com/windowsazure", "Type");
if (typeElement != null) {
String typeInstance;
typeInstance = typeElement.getTextContent();
result.setType(typeInstance);
}
Element idElement = XmlUtility.getElementByTagNameNS(extensionElement, "http://schemas.microsoft.com/windowsazure", "Id");
if (idElement != null) {
String idInstance;
idInstance = idElement.getTextContent();
result.setId(idInstance);
}
Element versionElement = XmlUtility.getElementByTagNameNS(extensionElement, "http://schemas.microsoft.com/windowsazure", "Version");
if (versionElement != null) {
String versionInstance;
versionInstance = versionElement.getTextContent();
result.setVersion(versionInstance);
}
Element thumbprintElement = XmlUtility.getElementByTagNameNS(extensionElement, "http://schemas.microsoft.com/windowsazure", "Thumbprint");
if (thumbprintElement != null) {
String thumbprintInstance;
thumbprintInstance = thumbprintElement.getTextContent();
result.setThumbprint(thumbprintInstance);
}
Element thumbprintAlgorithmElement = XmlUtility.getElementByTagNameNS(extensionElement, "http://schemas.microsoft.com/windowsazure", "ThumbprintAlgorithm");
if (thumbprintAlgorithmElement != null) {
String thumbprintAlgorithmInstance;
thumbprintAlgorithmInstance = thumbprintAlgorithmElement.getTextContent();
result.setThumbprintAlgorithm(thumbprintAlgorithmInstance);
}
Element publicConfigurationElement = XmlUtility.getElementByTagNameNS(extensionElement, "http://schemas.microsoft.com/windowsazure", "PublicConfiguration");
if (publicConfigurationElement != null) {
String publicConfigurationInstance;
publicConfigurationInstance = publicConfigurationElement.getTextContent() != null ? new String(Base64.decode(publicConfigurationElement.getTextContent())) : null;
result.setPublicConfiguration(publicConfigurationInstance);
}
}
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);
}