Merge "Enhanced List Level flow with backward support"
[so.git] / bpmn / MSOCommonBPMN / src / main / groovy / org / onap / so / bpmn / common / scripts / VnfAdapterRestV1.groovy
index 1452a9a..866229f 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 
 package org.onap.so.bpmn.common.scripts
 
+import org.onap.so.logger.LoggingAnchor
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.logger.ErrorCode
+
 import javax.ws.rs.core.Response
 import org.apache.commons.lang3.*
 import org.camunda.bpm.engine.delegate.BpmnError
@@ -27,15 +33,15 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.client.HttpClient
 import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
 import org.onap.so.utils.TargetEntity
 import java.util.UUID
 
 
 
-
 class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
-       private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterRestV1.class);
+    private static final Logger logger = LoggerFactory.getLogger( VnfAdapterRestV1.class);
 
 
        ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -45,7 +51,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
                def method = getClass().getSimpleName() + '.preProcessRequest(' +
                        'execution=' + execution.getId() +
                        ')'
-               msoLogger.trace('Entered ' + method)
+               logger.trace('Entered ' + method)
 
                def prefix="VNFREST_"
                execution.setVariable("prefix", prefix)
@@ -59,9 +65,9 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
                        Node root = new XmlParser().parseText(request)
                        String requestType = root.name()
                        execution.setVariable(prefix + 'requestType', requestType)
-                       msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
+                       logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
 
-                       msoLogger.debug('VnfAdapterRestV1, request: ' + request)
+                       logger.debug('VnfAdapterRestV1, request: ' + request)
                        // Get the messageId from the request
 
                        String messageId = getChildText(root, 'messageId')
@@ -72,12 +78,13 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                        if (messageId == null || messageId.isEmpty()) {
                                String msg = getProcessKey(execution) + ': no messageId in ' + requestType
-                               msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                               exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                               logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                               ErrorCode.UnknownError.getValue());
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                        }
 
                        execution.setVariable('VNFAResponse_CORRELATOR', messageId)
-                       msoLogger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId)
+                       logger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId)
 
                        // Get the notificationUrl from the request
 
@@ -85,12 +92,13 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                        if (notificationUrl == null || notificationUrl.isEmpty()) {
                                String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
-                               msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                               exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                               logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                               ErrorCode.UnknownError.getValue());
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                        }
 
                        execution.setVariable(prefix + 'notificationUrl', notificationUrl)
-                       msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl)
+                       logger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl)
 
                        // Determine the VnfAdapter endpoint
 
@@ -98,8 +106,9 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                        if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) {
                                String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
-                               msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                               exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                               logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                               ErrorCode.UnknownError.getValue());
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                        }
 
                        while (vnfAdapterEndpoint.endsWith('/')) {
@@ -115,8 +124,9 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                                if (vnfId == null || vnfId.isEmpty()) {
                                        String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
-                                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                                       ErrorCode.UnknownError.getValue());
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                                }
 
                                vnfAdapterMethod = 'POST'
@@ -127,16 +137,18 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                                if (vnfId == null || vnfId.isEmpty()) {
                                        String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
-                                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                                       ErrorCode.UnknownError.getValue());
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                                }
 
                                String vfModuleId = getChildText(root, 'vfModuleId')
 
                                if (vfModuleId == null || vfModuleId.isEmpty()) {
                                        String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
-                                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                                       ErrorCode.UnknownError.getValue());
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                                }
 
                                vnfAdapterMethod = 'PUT'
@@ -148,16 +160,18 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                                if (vnfId == null || vnfId.isEmpty()) {
                                        String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
-                                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                                       ErrorCode.UnknownError.getValue());
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                                }
 
                                String vfModuleId = getChildText(root, 'vfModuleId')
 
                                if (vfModuleId == null || vfModuleId.isEmpty()) {
                                        String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
-                                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                                       ErrorCode.UnknownError.getValue());
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                                }
 
                                vnfAdapterMethod = 'DELETE'
@@ -169,24 +183,27 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                                if (vfModuleRollbackNode == null) {
                                        String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
-                                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                                       ErrorCode.UnknownError.getValue());
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                                }
 
                                String vnfId = getChildText(vfModuleRollbackNode, 'vnfId')
 
                                if (vnfId == null || vnfId.isEmpty()) {
                                        String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
-                                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                                       ErrorCode.UnknownError.getValue());
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                                }
 
                                String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId')
 
                                if (vfModuleId == null || vfModuleId.isEmpty()) {
                                        String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
-                                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                                       ErrorCode.UnknownError.getValue());
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                                }
 
                                vnfAdapterMethod = 'DELETE'
@@ -205,8 +222,9 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                                if (volumeGroupId == null || volumeGroupId.isEmpty()) {
                                        String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
-                                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                                       ErrorCode.UnknownError.getValue());
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                                }
 
                                vnfAdapterMethod = 'PUT'
@@ -220,8 +238,9 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                                if (volumeGroupId == null || volumeGroupId.isEmpty()) {
                                        String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
-                                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                                       ErrorCode.UnknownError.getValue());
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                                }
 
                                vnfAdapterMethod = 'DELETE'
@@ -235,8 +254,9 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                                if (volumeGroupId == null || volumeGroupId.isEmpty()) {
                                        String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
-                                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                                       ErrorCode.UnknownError.getValue());
+                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                                }
 
                                vnfAdapterMethod = 'DELETE'
@@ -247,40 +267,46 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                        } else {
                                String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
-                               msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                               exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                               logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                               ErrorCode.UnknownError.getValue());
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                        }
 
                        execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
-                       msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod)
+                       logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod)
                        execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl)
-                       msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl)
+                       logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl)
                        execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest)
-                       msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest)
+                       logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest)
 
                        // Get the Basic Auth credentials for the VnfAdapter
 
                        String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
 
                        if (basicAuthValue == null || basicAuthValue.isEmpty()) {
-                               msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+                               logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                                               getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
+                                               ErrorCode.UnknownError.getValue());
                        } else {
                                try {
                                        def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
                                        execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
                                } catch (IOException ex) {
-                                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+                                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+                                                       getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter",
+                                                       "BPMN", ErrorCode.UnknownError.getValue(), ex);
                                }
                        }
 
                } catch (BpmnError e) {
-                       msoLogger.debug(" Rethrowing MSOWorkflowException")
+                       logger.debug(" Rethrowing MSOWorkflowException")
                        throw e
                } catch (Exception e) {
                        String msg = 'Caught exception in ' + method + ": " + e
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                       msoLogger.debug(msg)
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                       ErrorCode.UnknownError.getValue());
+                       logger.debug(msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                }
        }
 
@@ -300,7 +326,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
                def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' +
                        'execution=' + execution.getId() +
                        ')'
-               msoLogger.trace('Entered ' + method)
+               logger.trace('Entered ' + method)
 
                String prefix = execution.getVariable('prefix')
 
@@ -311,7 +337,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
 
                        URL url = new URL(vnfAdapterUrl);
 
-                       HttpClient httpClient = new HttpClient(url, "application/xml", TargetEntity.VNF_ADAPTER)
+                       HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.VNF_ADAPTER)
                        httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue"))
                        
                        httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
@@ -329,8 +355,9 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
                                response = httpClient.delete(vnfAdapterRequest)
                        } else {
                                String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
-                               msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                               exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                               logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                               ErrorCode.UnknownError.getValue());
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                        }
 
                        execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus())
@@ -341,8 +368,9 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
                        throw e
                } catch (Exception e) {
                        String msg = 'Caught exception in ' + method + ": " + e
-                       msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+                       logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+                                       ErrorCode.UnknownError.getValue());
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
                }
        }
 
@@ -350,12 +378,12 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
                def method = getClass().getSimpleName() + '.processCallback(' +
                        'execution=' + execution.getId() +
                        ')'
-               msoLogger.trace('Entered ' + method)
+               logger.trace('Entered ' + method)
 
                String callback = execution.getVariable('VNFAResponse_MESSAGE')
 
                try {
-                       msoLogger.debug(getProcessKey(execution) + ": received callback:\n" + callback)
+                       logger.debug(getProcessKey(execution) + ": received callback:\n" + callback)
 
                        // The XML callback is available to the calling flow in any case,
                        // even if a WorkflowException is generated.
@@ -363,16 +391,15 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
                        // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead.
                        execution.setVariable("WorkflowResponse", callback)
 
+                       callback = utils.removeXmlPreamble(callback)
+
                        Node root = new XmlParser().parseText(callback)
                        if (root.name().endsWith('Exception')) {
                                vnfAdapterWorkflowException(execution, callback)
                        }
                } catch (Exception e) {
-                       e.printStackTrace()
-                       callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback
-                       String msg = "Received error from VnfAdapter: " + callback
-                       msoLogger.debug(getProcessKey(execution) + ': ' + msg)
-                       exceptionUtil.buildWorkflowException(execution, 7020, msg)
+                       logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", TargetEntity.SO)
                }
        }
 
@@ -391,10 +418,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
                        String rolledBack = getChildText(root, "rolledBack")
                        rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
                        exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
-                               " from VnfAdapter:" + category + message + rolledBack);
+                               " from VnfAdapter:" + category + message + rolledBack, TargetEntity.OPENSTACK);
                } catch (Exception e) {
                        response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
-                       exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response)
+                       exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, TargetEntity.OPENSTACK)
                }
        }
 
@@ -423,4 +450,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
                Node child = getChild(node, name)
                return child == null ? null : child.text()
        }
+       
+       public Logger getLogger() {
+               return logger;
+       }
 }