+ NetConfResponse restResponse = XmlUtility.invokeMapperCall(baseUrl, requestXml, deviceID);\r
+\r
+ Document document = null;\r
+\r
+ ErrorCodeDetails errorCode = restResponse.getErrorCode();\r
+ if (errorCode != null && errorCode.getFaultCode() != null\r
+ && !errorCode.getFaultCode().equalsIgnoreCase("0")) {\r
+ logger.error("Error recevied : " + errorCode);\r
+ throw new DocumentedException(errorCode.getErrorMessage(),\r
+ ErrorType.from(errorCode.getErrorType()), ErrorTag.from(errorCode.getErrorTag()),\r
+ ErrorSeverity.from(errorCode.getErrorSeverity()));\r
+ } else if (restResponse != null && restResponse.getNetconfResponseXml() != null) {\r
+ logger.debug("soft-ware download rpc response received from mapper "\r
+ + restResponse.getNetconfResponseXml());\r
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\r
+ DocumentBuilder builder;\r
+ try {\r
+ builder = factory.newDocumentBuilder();\r
+ document =\r
+ builder.parse(new InputSource(new StringReader(restResponse.getNetconfResponseXml())));\r
+ document.getDocumentElement().setAttribute("xmlns:ns1", getOperationNamespace());\r
+ document.getDocumentElement().setAttribute("xmlns",\r
+ XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);\r
+ document.getDocumentElement().setAttribute(XmlNetconfConstants.MESSAGE_ID, msgId);\r
+ } catch (Exception e) {\r
+ logger.error("while contruscting the response; ", e.toString());\r
+ }\r
+ }\r