2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
7 * ================================================================================
8 * Modifications Copyright (c) 2019 Samsung
9 * ================================================================================
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 * ============LICENSE_END=========================================================
24 package org.onap.so.adapters.vnf;
27 import java.net.MalformedURLException;
29 import java.security.GeneralSecurityException;
30 import java.util.Collections;
31 import java.util.HashMap;
32 import java.util.List;
34 import javax.jws.WebService;
35 import javax.xml.bind.DatatypeConverter;
36 import javax.xml.namespace.QName;
37 import javax.xml.ws.BindingProvider;
38 import javax.xml.ws.Holder;
39 import javax.xml.ws.handler.MessageContext;
40 import org.onap.so.adapters.vnf.async.client.CreateVnfNotification;
41 import org.onap.so.adapters.vnf.async.client.QueryVnfNotification;
42 import org.onap.so.adapters.vnf.async.client.UpdateVnfNotification;
43 import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify;
44 import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service;
45 import org.onap.so.adapters.vnf.exceptions.VnfException;
46 import org.onap.so.entity.MsoRequest;
47 import org.onap.so.logger.ErrorCode;
48 import org.onap.so.logger.MessageEnum;
49 import org.onap.so.openstack.beans.VnfRollback;
50 import org.onap.so.openstack.beans.VnfStatus;
51 import org.onap.so.utils.CryptoUtils;
52 import org.slf4j.Logger;
53 import org.slf4j.LoggerFactory;
54 import org.springframework.beans.factory.annotation.Autowired;
55 import org.springframework.core.env.Environment;
56 import org.springframework.stereotype.Component;
58 @WebService(serviceName = "VnfAdapterAsync", endpointInterface = "org.onap.so.adapters.vnf.MsoVnfAdapterAsync", targetNamespace = "http://org.onap.so/vnfA")
60 public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
62 private static final Logger logger = LoggerFactory.getLogger(MsoVnfAdapterAsyncImpl.class);
64 private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth";
65 private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey";
68 private Environment environment;
71 private MsoVnfAdapterImpl vnfImpl;
74 * Health Check web method. Does nothing but return to show the adapter is deployed.
77 public void healthCheckA () {
78 logger.debug ("Health check call in VNF Adapter");
82 * This is the asynchronous "Create VNF" web service implementation.
83 * It will create a new VNF of the requested type in the specified cloud
84 * and tenant. The tenant must exist before this service is called.
86 * If a VNF with the same name already exists, this can be considered a
87 * success or failure, depending on the value of the 'failIfExists' parameter.
89 * All VNF types will be defined in the MSO catalog. The caller must request
90 * one of these pre-defined types or an error will be returned. Within the
91 * catalog, each VNF type references (among other things) a Heat template
92 * which is used to deploy the required VNF artifacts (VMs, networks, etc.)
95 * Depending on the Heat template, a variable set of input parameters will
96 * be defined, some of which are required. The caller is responsible to
97 * pass the necessary input data for the VNF or an error will be thrown.
99 * The method sends an asynchronous response to the notification URL when
100 * processing completes. The createAsyncResponse contains the vnfId (the
101 * canonical name of the stack), a Map of VNF output attributes, and a
102 * VnfRollback object. This last object can be passed as-is to the
103 * rollbackVnf operation to undo everything that was created for the VNF.
104 * This is useful if a VNF is successfully created but the orchestrator
105 * fails on a subsequent operation.
107 * Note: this method is implemented by calling the synchronous web method
108 * and translating the response to an asynchronous notification.
110 * @param cloudSiteId CLLI code of the cloud site in which to create the VNF
111 * @param cloudOwner cloud owner of the cloud site in which to create the VNF
112 * @param tenantId Openstack tenant identifier
113 * @param vnfType VNF type key, should match a VNF definition in catalog DB
114 * @param vnfName Name to be assigned to the new VNF
115 * @param inputs Map of key=value inputs for VNF stack creation
116 * @param failIfExists Flag whether already existing VNF should be considered
117 * a success or failure
118 * @param msoRequest Request tracking information for logs
119 * @param notificationURL the target URL for asynchronous response
122 public void createVnfA (String cloudSiteId,
129 String volumeGroupHeatStackId,
130 Map <String, Object> inputs,
131 Boolean failIfExists,
133 Boolean enableBridge,
135 MsoRequest msoRequest,
136 String notificationUrl) {
138 logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF);
139 // Use the synchronous method to perform the actual Create
140 MsoVnfAdapter vnfAdapter = vnfImpl;
141 // Synchronous Web Service Outputs
142 Holder <String> vnfId = new Holder <> ();
143 Holder <Map <String, String>> outputs = new Holder <> ();
144 Holder <VnfRollback> vnfRollback = new Holder <> ();
147 vnfAdapter.createVnf (cloudSiteId,
154 volumeGroupHeatStackId,
163 } catch (VnfException e) {
164 logger.error("{} {} VnfException in createVnfA ", MessageEnum.RA_CREATE_VNF_ERR,
165 ErrorCode.BusinessProcesssError.getValue(), e);
166 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
169 eMsg = e.getFaultInfo ().getMessage ();
170 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
173 } catch (Exception e1) {
174 logger.error("{} {} Exception - Fault info ", MessageEnum.RA_FAULT_INFO_EXC,
175 ErrorCode.BusinessProcesssError.getValue(), e1);
177 // Build and send Asynchronous error response
179 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
180 notifyPort.createVnfNotification (messageId, false, exCat, eMsg, null, null, null);
181 } catch (Exception e1) {
182 logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
183 ErrorCode.BusinessProcesssError.getValue(), e1);
185 logger.info("{}", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
188 logger.debug("Async Create VNF: {} VnfId:{}", vnfName, vnfId.value);
189 // Build and send Asynchronous response
191 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
192 notifyPort.createVnfNotification (messageId,
197 copyCreateOutputs (outputs),
198 copyVrb (vnfRollback));
199 } catch (Exception e) {
200 logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
201 ErrorCode.BusinessProcesssError.getValue(), e);
203 logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
208 public void updateVnfA (String cloudSiteId,
215 String volumeGroupHeatStackId,
216 Map <String, Object> inputs,
218 MsoRequest msoRequest,
219 String notificationUrl) {
221 logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF);
223 // Use the synchronous method to perform the actual Create
224 MsoVnfAdapter vnfAdapter = vnfImpl;
226 // Synchronous Web Service Outputs
227 Holder <String> vnfId = new Holder <> ();
228 Holder <Map <String, String>> outputs = new Holder <> ();
229 Holder <VnfRollback> vnfRollback = new Holder <> ();
232 vnfAdapter.updateVnf (cloudSiteId, cloudOwner, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback);
233 } catch (VnfException e) {
234 logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_UPDATE_VNF_ERR,
235 ErrorCode.BusinessProcesssError.getValue(), e);
236 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
239 eMsg = e.getFaultInfo ().getMessage ();
240 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
243 } catch (Exception e1) {
244 logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
245 ErrorCode.BusinessProcesssError.getValue(), e1);
247 // Build and send Asynchronous error response
249 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
250 notifyPort.updateVnfNotification (messageId, false, exCat, eMsg, null, null);
251 } catch (Exception e1) {
252 logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
253 ErrorCode.BusinessProcesssError.getValue(), e1);
255 logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
258 logger.debug("Async Update VNF: {} VnfId:{}", vnfName, vnfId.value);
259 // Build and send Asynchronous response
261 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
262 notifyPort.updateVnfNotification (messageId,
266 copyUpdateOutputs (outputs),
267 copyVrb (vnfRollback));
268 } catch (Exception e) {
269 logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
270 ErrorCode.BusinessProcesssError.getValue(), e);
272 logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
277 * This is the "Query VNF" web service implementation.
278 * It will look up a VNF by name or ID in the specified cloud and tenant.
280 * The method returns an indicator that the VNF exists, its Openstack internal
281 * ID, its status, and the set of outputs (from when the stack was created).
283 * @param cloudSiteId CLLI code of the cloud site in which to query
284 * @param cloudOwner cloud owner of cloud site in which to query
285 * @param tenantId Openstack tenant identifier
286 * @param vnfName VNF Name or Openstack ID
287 * @param msoRequest Request tracking information for logs
288 * @param notificationURL the target URL for asynchronous response
291 public void queryVnfA (String cloudSiteId,
296 MsoRequest msoRequest,
297 String notificationUrl) {
299 String serviceName = "QueryVnfA";
300 logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF);
302 // Use the synchronous method to perform the actual query
303 MsoVnfAdapter vnfAdapter = vnfImpl;
305 // Synchronous Web Service Outputs
306 Holder <Boolean> vnfExists = new Holder <> ();
307 Holder <String> vnfId = new Holder <> ();
308 Holder <VnfStatus> status = new Holder <> ();
309 Holder <Map <String, String>> outputs = new Holder <> ();
312 vnfAdapter.queryVnf (cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs);
313 } catch (VnfException e) {
314 logger.error("{} {} Exception sending queryVnfA notification ", MessageEnum.RA_QUERY_VNF_ERR,
315 ErrorCode.BusinessProcesssError.getValue(), e);
316 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
319 eMsg = e.getFaultInfo ().getMessage ();
320 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
323 } catch (Exception e1) {
324 logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
325 ErrorCode.BusinessProcesssError.getValue(), e1);
327 // Build and send Asynchronous error response
329 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
330 notifyPort.queryVnfNotification (messageId, false, exCat, eMsg, null, null, null, null);
331 } catch (Exception e1) {
332 logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
333 ErrorCode.BusinessProcesssError.getValue(), e1);
335 logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE);
339 if (!vnfExists.value) {
340 logger.debug ("Async Query, VNF not found");
342 logger.debug("Async Query, VNF={}, status={}", vnfId.value, status.value);
344 // Build and send Asynchronous response
346 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
347 org.onap.so.adapters.vnf.async.client.VnfStatus vnfS = org.onap.so.adapters.vnf.async.client.VnfStatus.fromValue (status.value.name ());
348 notifyPort.queryVnfNotification (messageId,
355 copyQueryOutputs (outputs));
356 } catch (Exception e) {
357 logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
358 ErrorCode.BusinessProcesssError.getValue(), e);
361 logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE);
366 * This is the Asynchronous "Delete VNF" web service implementation.
367 * It will delete a VNF by name or ID in the specified cloud and tenant.
369 * The method has no outputs.
371 * @param cloudSiteId CLLI code of the cloud site in which to delete
372 * @param cloudOwner cloud owner of cloud site in which to delete
373 * @param tenantId Openstack tenant identifier
374 * @param vnfName VNF Name or Openstack ID
375 * @param msoRequest Request tracking information for logs
376 * @param notificationURL the target URL for asynchronous response
379 public void deleteVnfA (String cloudSiteId,
384 MsoRequest msoRequest,
385 String notificationUrl) {
387 String serviceName = "DeleteVnfA";
388 logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF);
390 // Use the synchronous method to perform the actual delete
391 MsoVnfAdapter vnfAdapter = vnfImpl;
394 vnfAdapter.deleteVnf (cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest);
395 } catch (VnfException e) {
396 logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR,
397 ErrorCode.BusinessProcesssError.getValue(), e);
398 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
401 eMsg = e.getFaultInfo ().getMessage ();
402 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
405 } catch (Exception e1) {
406 logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
407 ErrorCode.BusinessProcesssError.getValue(), e1);
409 // Build and send Asynchronous error response
411 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
412 notifyPort.deleteVnfNotification (messageId, false, exCat, eMsg);
413 } catch (Exception e1) {
414 logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
415 ErrorCode.BusinessProcesssError.getValue(), e1);
417 logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE);
421 logger.debug("Async Delete VNF: {}", vnfName);
422 // Build and send Asynchronous response
424 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
425 notifyPort.deleteVnfNotification (messageId, true, null, null);
427 } catch (Exception e) {
428 logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
429 ErrorCode.BusinessProcesssError.getValue(), e);
432 logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE);
437 * This web service endpoint will rollback a previous Create VNF operation.
438 * A rollback object is returned to the client in a successful creation
439 * response. The client can pass that object as-is back to the rollbackVnf
440 * operation to undo the creation.
443 public void rollbackVnfA (VnfRollback rollback, String messageId, String notificationUrl) {
444 // rollback may be null (e.g. if stack already existed when Create was called)
445 if (rollback == null) {
446 logger.info("{} rollbackVnfA: Empty Rollback: No action to perform", MessageEnum.RA_ROLLBACK_NULL);
450 logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF);
452 // Use the synchronous method to perform the actual rollback
453 MsoVnfAdapter vnfAdapter = vnfImpl;
456 vnfAdapter.rollbackVnf (rollback);
457 } catch (VnfException e) {
458 logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_ROLLBACK_VNF_ERR,
459 ErrorCode.BusinessProcesssError.getValue(), e);
460 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
463 eMsg = e.getFaultInfo ().getMessage ();
464 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
467 } catch (Exception e1) {
468 logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
469 ErrorCode.BusinessProcesssError.getValue(), e1);
471 // Build and send Asynchronous error response
473 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
474 notifyPort.rollbackVnfNotification (messageId, false, exCat, eMsg);
475 } catch (Exception e1) {
476 logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
477 ErrorCode.BusinessProcesssError.getValue(), e1);
479 logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE);
483 logger.debug ("Async Rollback VNF:" + rollback.getVnfId ());
484 // Build and send Asynchronous response
486 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
487 notifyPort.rollbackVnfNotification (messageId, true, null, null);
488 } catch (Exception e) {
489 logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
490 ErrorCode.BusinessProcesssError.getValue(), e);
493 logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE);
497 private org.onap.so.adapters.vnf.async.client.VnfRollback copyVrb (Holder <VnfRollback> hVrb) {
498 org.onap.so.adapters.vnf.async.client.VnfRollback cvrb = new org.onap.so.adapters.vnf.async.client.VnfRollback ();
500 if (hVrb != null && hVrb.value != null) {
501 org.onap.so.adapters.vnf.async.client.MsoRequest cmr = new org.onap.so.adapters.vnf.async.client.MsoRequest ();
503 cvrb.setCloudSiteId (hVrb.value.getCloudSiteId ());
504 if (hVrb.value.getMsoRequest() != null) {
505 cmr.setRequestId (hVrb.value.getMsoRequest ().getRequestId ());
506 cmr.setServiceInstanceId (hVrb.value.getMsoRequest ().getServiceInstanceId ());
508 cmr.setRequestId (null);
509 cmr.setServiceInstanceId (null);
511 cvrb.setMsoRequest (cmr);
512 cvrb.setVnfId (hVrb.value.getVnfId ());
513 cvrb.setTenantId (hVrb.value.getTenantId ());
514 cvrb.setTenantCreated (hVrb.value.getTenantCreated ());
515 cvrb.setVnfCreated (hVrb.value.getVnfCreated ());
520 private CreateVnfNotification.Outputs copyCreateOutputs (Holder <Map <String, String>> hMap) {
522 CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs ();
524 if (hMap != null && hMap.value != null) {
525 Map <String, String> sMap = new HashMap <> ();
527 CreateVnfNotification.Outputs.Entry entry = new CreateVnfNotification.Outputs.Entry ();
529 for (String key : sMap.keySet ()) {
531 entry.setValue (sMap.get (key));
532 outputs.getEntry ().add (entry);
538 private UpdateVnfNotification.Outputs copyUpdateOutputs (Holder <Map <String, String>> hMap) {
540 UpdateVnfNotification.Outputs outputs = new UpdateVnfNotification.Outputs ();
542 if (hMap != null && hMap.value != null) {
543 Map <String, String> sMap = new HashMap <> ();
545 UpdateVnfNotification.Outputs.Entry entry = new UpdateVnfNotification.Outputs.Entry ();
547 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
548 String key = mapEntry.getKey();
549 String value = mapEntry.getValue();
551 entry.setValue (value);
552 outputs.getEntry ().add (entry);
558 private QueryVnfNotification.Outputs copyQueryOutputs (Holder <Map <String, String>> hMap) {
560 QueryVnfNotification.Outputs outputs = new QueryVnfNotification.Outputs ();
562 if (hMap != null && hMap.value != null) {
563 Map <String, String> sMap = new HashMap <> ();
566 QueryVnfNotification.Outputs.Entry entry = new QueryVnfNotification.Outputs.Entry ();
568 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
569 String key = mapEntry.getKey();
570 String value = mapEntry.getValue();
572 entry.setValue (value);
573 outputs.getEntry ().add (entry);
579 private VnfAdapterNotify getNotifyEP (String notificationUrl) {
581 URL warWsdlLoc = null;
583 warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("VnfAdapterNotify.wsdl");
584 } catch (Exception e) {
585 logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND,
586 ErrorCode.BusinessProcesssError.getValue(), e);
588 if (warWsdlLoc == null) {
589 logger.error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND,
590 ErrorCode.BusinessProcesssError.getValue());
593 logger.debug("VnfAdpaterNotify.wsdl location:{}", warWsdlLoc.toURI().toString());
594 } catch (Exception e) {
595 logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC,
596 ErrorCode.BusinessProcesssError.getValue(), e);
600 VnfAdapterNotify_Service notifySvc = new VnfAdapterNotify_Service (warWsdlLoc,
601 new QName ("http://org.onap.so/vnfNotify",
602 "vnfAdapterNotify"));
604 VnfAdapterNotify notifyPort = notifySvc.getMsoVnfAdapterAsyncImplPort ();
606 BindingProvider bp = (BindingProvider) notifyPort;
610 epUrl = new URL (notificationUrl);
611 } catch (MalformedURLException e1) {
612 logger.error("{} {} MalformedURLException ", MessageEnum.RA_INIT_NOTIF_EXC,
613 ErrorCode.BusinessProcesssError.getValue(), e1);
617 logger.debug("Notification Endpoint URL: {}", epUrl.toExternalForm());
618 bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
621 logger.debug ("epUrl is NULL:");
626 Map <String, Object> reqCtx = bp.getRequestContext ();
627 Map <String, List <String>> headers = new HashMap <> ();
629 String userCredentials = this.getEncryptedProperty(BPEL_AUTH_PROP, "", ENCRYPTION_KEY_PROP);
631 String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ());
632 reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers);
633 headers.put ("Authorization", Collections.singletonList (basicAuth));
634 } catch (Exception e) {
635 logger.error("{} {} Exception - Unable to set authorization in callback request ",
636 MessageEnum.RA_SET_CALLBACK_AUTH_EXC, ErrorCode.BusinessProcesssError.getValue(), e);
642 public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
644 return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey));
645 } catch (GeneralSecurityException e) {
646 logger.debug("Exception while decrypting property: {} ", this.environment.getProperty(key), e);