}
throw ex;
}
// Create Result
ManagementCertificateGetResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new ManagementCertificateGetResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element subscriptionCertificateElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "SubscriptionCertificate");
if (subscriptionCertificateElement != null) {
Element subscriptionCertificatePublicKeyElement = XmlUtility.getElementByTagNameNS(subscriptionCertificateElement, "http://schemas.microsoft.com/windowsazure", "SubscriptionCertificatePublicKey");
if (subscriptionCertificatePublicKeyElement != null) {
byte[] subscriptionCertificatePublicKeyInstance;
subscriptionCertificatePublicKeyInstance = subscriptionCertificatePublicKeyElement.getTextContent() != null ? Base64.decode(subscriptionCertificatePublicKeyElement.getTextContent()) : null;
result.setPublicKey(subscriptionCertificatePublicKeyInstance);
}
Element subscriptionCertificateThumbprintElement = XmlUtility.getElementByTagNameNS(subscriptionCertificateElement, "http://schemas.microsoft.com/windowsazure", "SubscriptionCertificateThumbprint");
if (subscriptionCertificateThumbprintElement != null) {
String subscriptionCertificateThumbprintInstance;
subscriptionCertificateThumbprintInstance = subscriptionCertificateThumbprintElement.getTextContent();
result.setThumbprint(subscriptionCertificateThumbprintInstance);
}
Element subscriptionCertificateDataElement = XmlUtility.getElementByTagNameNS(subscriptionCertificateElement, "http://schemas.microsoft.com/windowsazure", "SubscriptionCertificateData");
if (subscriptionCertificateDataElement != null) {
byte[] subscriptionCertificateDataInstance;
subscriptionCertificateDataInstance = subscriptionCertificateDataElement.getTextContent() != null ? Base64.decode(subscriptionCertificateDataElement.getTextContent()) : null;
result.setData(subscriptionCertificateDataInstance);
}
Element createdElement = XmlUtility.getElementByTagNameNS(subscriptionCertificateElement, "http://schemas.microsoft.com/windowsazure", "Created");
if (createdElement != null) {
Calendar createdInstance;
createdInstance = DatatypeConverter.parseDateTime(createdElement.getTextContent());
result.setCreated(createdInstance);
}
}
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);
}