}
throw ex;
}
// Create Result
NetworkReservedIPGetResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new NetworkReservedIPGetResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element reservedIPElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "ReservedIP");
if (reservedIPElement != null) {
Element nameElement = XmlUtility.getElementByTagNameNS(reservedIPElement, "http://schemas.microsoft.com/windowsazure", "Name");
if (nameElement != null) {
String nameInstance;
nameInstance = nameElement.getTextContent();
result.setName(nameInstance);
}
Element addressElement = XmlUtility.getElementByTagNameNS(reservedIPElement, "http://schemas.microsoft.com/windowsazure", "Address");
if (addressElement != null) {
InetAddress addressInstance;
addressInstance = InetAddress.getByName(addressElement.getTextContent());
result.setAddress(addressInstance);
}
Element idElement = XmlUtility.getElementByTagNameNS(reservedIPElement, "http://schemas.microsoft.com/windowsazure", "Id");
if (idElement != null) {
String idInstance;
idInstance = idElement.getTextContent();
result.setId(idInstance);
}
Element labelElement = XmlUtility.getElementByTagNameNS(reservedIPElement, "http://schemas.microsoft.com/windowsazure", "Label");
if (labelElement != null) {
String labelInstance;
labelInstance = labelElement.getTextContent();
result.setLabel(labelInstance);
}
Element stateElement = XmlUtility.getElementByTagNameNS(reservedIPElement, "http://schemas.microsoft.com/windowsazure", "State");
if (stateElement != null) {
String stateInstance;
stateInstance = stateElement.getTextContent();
result.setState(stateInstance);
}
Element inUseElement = XmlUtility.getElementByTagNameNS(reservedIPElement, "http://schemas.microsoft.com/windowsazure", "InUse");
if (inUseElement != null) {
boolean inUseInstance;
inUseInstance = DatatypeConverter.parseBoolean(inUseElement.getTextContent().toLowerCase());
result.setInUse(inUseInstance);
}
Element serviceNameElement = XmlUtility.getElementByTagNameNS(reservedIPElement, "http://schemas.microsoft.com/windowsazure", "ServiceName");
if (serviceNameElement != null) {
String serviceNameInstance;
serviceNameInstance = serviceNameElement.getTextContent();
result.setServiceName(serviceNameInstance);
}
Element deploymentNameElement = XmlUtility.getElementByTagNameNS(reservedIPElement, "http://schemas.microsoft.com/windowsazure", "DeploymentName");
if (deploymentNameElement != null) {
String deploymentNameInstance;
deploymentNameInstance = deploymentNameElement.getTextContent();
result.setDeploymentName(deploymentNameInstance);
}
Element locationElement = XmlUtility.getElementByTagNameNS(reservedIPElement, "http://schemas.microsoft.com/windowsazure", "Location");
if (locationElement != null) {
String locationInstance;
locationInstance = locationElement.getTextContent();
result.setLocation(locationInstance);
}
}
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);
}