}
throw ex;
}
// Create Result
ServiceBusRegionsResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new ServiceBusRegionsResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element feedElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://www.w3.org/2005/Atom", "feed");
if (feedElement != null) {
if (feedElement != null) {
for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(feedElement, "http://www.w3.org/2005/Atom", "entry").size(); i1 = i1 + 1) {
org.w3c.dom.Element entriesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(feedElement, "http://www.w3.org/2005/Atom", "entry").get(i1));
ServiceBusLocation entryInstance = new ServiceBusLocation();
result.getRegions().add(entryInstance);
Element contentElement = XmlUtility.getElementByTagNameNS(entriesElement, "http://www.w3.org/2005/Atom", "content");
if (contentElement != null) {
Element regionCodeDescriptionElement = XmlUtility.getElementByTagNameNS(contentElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "RegionCodeDescription");
if (regionCodeDescriptionElement != null) {
Element codeElement = XmlUtility.getElementByTagNameNS(regionCodeDescriptionElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "Code");
if (codeElement != null) {
String codeInstance;
codeInstance = codeElement.getTextContent();
entryInstance.setCode(codeInstance);
}
Element fullNameElement = XmlUtility.getElementByTagNameNS(regionCodeDescriptionElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "FullName");
if (fullNameElement != null) {
String fullNameInstance;
fullNameInstance = fullNameElement.getTextContent();
entryInstance.setFullName(fullNameInstance);
}
}
}
}
}
}
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);
}