}
throw ex;
}
// Create Result
ServerListResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new ServerListResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element serversSequenceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/sqlazure/2010/12/", "Servers");
if (serversSequenceElement != null) {
for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(serversSequenceElement, "http://schemas.microsoft.com/sqlazure/2010/12/", "Server").size(); i1 = i1 + 1) {
org.w3c.dom.Element serversElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(serversSequenceElement, "http://schemas.microsoft.com/sqlazure/2010/12/", "Server").get(i1));
Server serverInstance = new Server();
result.getServers().add(serverInstance);
Element nameElement = XmlUtility.getElementByTagNameNS(serversElement, "http://schemas.microsoft.com/sqlazure/2010/12/", "Name");
if (nameElement != null) {
String nameInstance;
nameInstance = nameElement.getTextContent();
serverInstance.setName(nameInstance);
}
Element administratorLoginElement = XmlUtility.getElementByTagNameNS(serversElement, "http://schemas.microsoft.com/sqlazure/2010/12/", "AdministratorLogin");
if (administratorLoginElement != null) {
String administratorLoginInstance;
administratorLoginInstance = administratorLoginElement.getTextContent();
serverInstance.setAdministratorUserName(administratorLoginInstance);
}
Element locationElement = XmlUtility.getElementByTagNameNS(serversElement, "http://schemas.microsoft.com/sqlazure/2010/12/", "Location");
if (locationElement != null) {
String locationInstance;
locationInstance = locationElement.getTextContent();
serverInstance.setLocation(locationInstance);
}
Element fullyQualifiedDomainNameElement = XmlUtility.getElementByTagNameNS(serversElement, "http://schemas.microsoft.com/sqlazure/2010/12/", "FullyQualifiedDomainName");
if (fullyQualifiedDomainNameElement != null) {
String fullyQualifiedDomainNameInstance;
fullyQualifiedDomainNameInstance = fullyQualifiedDomainNameElement.getTextContent();
serverInstance.setFullyQualifiedDomainName(fullyQualifiedDomainNameInstance);
}
Element stateElement = XmlUtility.getElementByTagNameNS(serversElement, "http://schemas.microsoft.com/sqlazure/2010/12/", "State");
if (stateElement != null) {
String stateInstance;
stateInstance = stateElement.getTextContent();
serverInstance.setState(stateInstance);
}
Element versionElement = XmlUtility.getElementByTagNameNS(serversElement, "http://schemas.microsoft.com/sqlazure/2010/12/", "Version");
if (versionElement != null) {
String versionInstance;
versionInstance = versionElement.getTextContent();
serverInstance.setVersion(versionInstance);
}
}
}
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);
}