}
throw ex;
}
// Create Result
ServiceCertificateListResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new ServiceCertificateListResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element certificatesSequenceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "Certificates");
if (certificatesSequenceElement != null) {
for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(certificatesSequenceElement, "http://schemas.microsoft.com/windowsazure", "Certificate").size(); i1 = i1 + 1) {
org.w3c.dom.Element certificatesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(certificatesSequenceElement, "http://schemas.microsoft.com/windowsazure", "Certificate").get(i1));
ServiceCertificateListResponse.Certificate certificateInstance = new ServiceCertificateListResponse.Certificate();
result.getCertificates().add(certificateInstance);
Element certificateUrlElement = XmlUtility.getElementByTagNameNS(certificatesElement, "http://schemas.microsoft.com/windowsazure", "CertificateUrl");
if (certificateUrlElement != null) {
URI certificateUrlInstance;
certificateUrlInstance = new URI(certificateUrlElement.getTextContent());
certificateInstance.setCertificateUri(certificateUrlInstance);
}
Element thumbprintElement = XmlUtility.getElementByTagNameNS(certificatesElement, "http://schemas.microsoft.com/windowsazure", "Thumbprint");
if (thumbprintElement != null) {
String thumbprintInstance;
thumbprintInstance = thumbprintElement.getTextContent();
certificateInstance.setThumbprint(thumbprintInstance);
}
Element thumbprintAlgorithmElement = XmlUtility.getElementByTagNameNS(certificatesElement, "http://schemas.microsoft.com/windowsazure", "ThumbprintAlgorithm");
if (thumbprintAlgorithmElement != null) {
String thumbprintAlgorithmInstance;
thumbprintAlgorithmInstance = thumbprintAlgorithmElement.getTextContent();
certificateInstance.setThumbprintAlgorithm(thumbprintAlgorithmInstance);
}
Element dataElement = XmlUtility.getElementByTagNameNS(certificatesElement, "http://schemas.microsoft.com/windowsazure", "Data");
if (dataElement != null) {
byte[] dataInstance;
dataInstance = dataElement.getTextContent() != null ? Base64.decode(dataElement.getTextContent()) : null;
certificateInstance.setData(dataInstance);
}
}
}
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);
}