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.MessageEnum;
48 import org.onap.so.logger.MsoLogger;
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 tenantId Openstack tenant identifier
112 * @param vnfType VNF type key, should match a VNF definition in catalog DB
113 * @param vnfName Name to be assigned to the new VNF
114 * @param inputs Map of key=value inputs for VNF stack creation
115 * @param failIfExists Flag whether already existing VNF should be considered
116 * a success or failure
117 * @param msoRequest Request tracking information for logs
118 * @param notificationURL the target URL for asynchronous response
121 public void createVnfA (String cloudSiteId,
127 String volumeGroupHeatStackId,
128 Map <String, Object> inputs,
129 Boolean failIfExists,
131 Boolean enableBridge,
133 MsoRequest msoRequest,
134 String notificationUrl) {
135 MsoLogger.setLogContext (msoRequest);
136 logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF);
137 // Use the synchronous method to perform the actual Create
138 MsoVnfAdapter vnfAdapter = vnfImpl;
139 // Synchronous Web Service Outputs
140 Holder <String> vnfId = new Holder <> ();
141 Holder <Map <String, String>> outputs = new Holder <> ();
142 Holder <VnfRollback> vnfRollback = new Holder <> ();
145 vnfAdapter.createVnf (cloudSiteId,
151 volumeGroupHeatStackId,
160 } catch (VnfException e) {
161 logger.error("{} {} VnfException in createVnfA ", MessageEnum.RA_CREATE_VNF_ERR,
162 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
163 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
166 eMsg = e.getFaultInfo ().getMessage ();
167 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
170 } catch (Exception e1) {
171 logger.error("{} {} Exception - Fault info ", MessageEnum.RA_FAULT_INFO_EXC,
172 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
174 // Build and send Asynchronous error response
176 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
177 notifyPort.createVnfNotification (messageId, false, exCat, eMsg, null, null, null);
178 } catch (Exception e1) {
179 logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
180 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
182 logger.info("{}", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
185 logger.debug("Async Create VNF: {} VnfId:{}", vnfName, vnfId.value);
186 // Build and send Asynchronous response
188 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
189 notifyPort.createVnfNotification (messageId,
194 copyCreateOutputs (outputs),
195 copyVrb (vnfRollback));
196 } catch (Exception e) {
197 logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
198 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
200 logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
205 public void updateVnfA (String cloudSiteId,
211 String volumeGroupHeatStackId,
212 Map <String, Object> inputs,
214 MsoRequest msoRequest,
215 String notificationUrl) {
216 MsoLogger.setLogContext (msoRequest);
217 logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF);
219 // Use the synchronous method to perform the actual Create
220 MsoVnfAdapter vnfAdapter = vnfImpl;
222 // Synchronous Web Service Outputs
223 Holder <String> vnfId = new Holder <> ();
224 Holder <Map <String, String>> outputs = new Holder <> ();
225 Holder <VnfRollback> vnfRollback = new Holder <> ();
228 vnfAdapter.updateVnf (cloudSiteId, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback);
229 } catch (VnfException e) {
230 logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_UPDATE_VNF_ERR,
231 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
232 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
235 eMsg = e.getFaultInfo ().getMessage ();
236 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
239 } catch (Exception e1) {
240 logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
241 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
243 // Build and send Asynchronous error response
245 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
246 notifyPort.updateVnfNotification (messageId, false, exCat, eMsg, null, null);
247 } catch (Exception e1) {
248 logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
249 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
251 logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
254 logger.debug("Async Update VNF: {} VnfId:{}", vnfName, vnfId.value);
255 // Build and send Asynchronous response
257 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
258 notifyPort.updateVnfNotification (messageId,
262 copyUpdateOutputs (outputs),
263 copyVrb (vnfRollback));
264 } catch (Exception e) {
265 logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
266 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
268 logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
273 * This is the "Query VNF" web service implementation.
274 * It will look up a VNF by name or ID in the specified cloud and tenant.
276 * The method returns an indicator that the VNF exists, its Openstack internal
277 * ID, its status, and the set of outputs (from when the stack was created).
279 * @param cloudSiteId CLLI code of the cloud site in which to query
280 * @param tenantId Openstack tenant identifier
281 * @param vnfName VNF Name or Openstack ID
282 * @param msoRequest Request tracking information for logs
283 * @param notificationURL the target URL for asynchronous response
286 public void queryVnfA (String cloudSiteId,
290 MsoRequest msoRequest,
291 String notificationUrl) {
293 String serviceName = "QueryVnfA";
294 MsoLogger.setLogContext (msoRequest);
295 logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF);
297 // Use the synchronous method to perform the actual query
298 MsoVnfAdapter vnfAdapter = vnfImpl;
300 // Synchronous Web Service Outputs
301 Holder <Boolean> vnfExists = new Holder <> ();
302 Holder <String> vnfId = new Holder <> ();
303 Holder <VnfStatus> status = new Holder <> ();
304 Holder <Map <String, String>> outputs = new Holder <> ();
307 vnfAdapter.queryVnf (cloudSiteId, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs);
308 } catch (VnfException e) {
309 logger.error("{} {} Exception sending queryVnfA notification ", MessageEnum.RA_QUERY_VNF_ERR,
310 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
311 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
314 eMsg = e.getFaultInfo ().getMessage ();
315 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
318 } catch (Exception e1) {
319 logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
320 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
322 // Build and send Asynchronous error response
324 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
325 notifyPort.queryVnfNotification (messageId, false, exCat, eMsg, null, null, null, null);
326 } catch (Exception e1) {
327 logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
328 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
330 logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE);
334 if (!vnfExists.value) {
335 logger.debug ("Async Query, VNF not found");
337 logger.debug("Async Query, VNF={}, status={}", vnfId.value, status.value);
339 // Build and send Asynchronous response
341 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
342 org.onap.so.adapters.vnf.async.client.VnfStatus vnfS = org.onap.so.adapters.vnf.async.client.VnfStatus.fromValue (status.value.name ());
343 notifyPort.queryVnfNotification (messageId,
350 copyQueryOutputs (outputs));
351 } catch (Exception e) {
352 logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
353 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
356 logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE);
361 * This is the Asynchronous "Delete VNF" web service implementation.
362 * It will delete a VNF by name or ID in the specified cloud and tenant.
364 * The method has no outputs.
366 * @param cloudSiteId CLLI code of the cloud site in which to delete
367 * @param tenantId Openstack tenant identifier
368 * @param vnfName VNF Name or Openstack ID
369 * @param msoRequest Request tracking information for logs
370 * @param notificationURL the target URL for asynchronous response
373 public void deleteVnfA (String cloudSiteId,
377 MsoRequest msoRequest,
378 String notificationUrl) {
380 String serviceName = "DeleteVnfA";
381 MsoLogger.setLogContext (msoRequest);
382 logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF);
384 // Use the synchronous method to perform the actual delete
385 MsoVnfAdapter vnfAdapter = vnfImpl;
388 vnfAdapter.deleteVnf (cloudSiteId, tenantId, vnfName, msoRequest);
389 } catch (VnfException e) {
390 logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR,
391 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
392 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
395 eMsg = e.getFaultInfo ().getMessage ();
396 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
399 } catch (Exception e1) {
400 logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
401 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
403 // Build and send Asynchronous error response
405 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
406 notifyPort.deleteVnfNotification (messageId, false, exCat, eMsg);
407 } catch (Exception e1) {
408 logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
409 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
411 logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE);
415 logger.debug("Async Delete VNF: {}", vnfName);
416 // Build and send Asynchronous response
418 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
419 notifyPort.deleteVnfNotification (messageId, true, null, null);
421 } catch (Exception e) {
422 logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
423 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
426 logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE);
431 * This web service endpoint will rollback a previous Create VNF operation.
432 * A rollback object is returned to the client in a successful creation
433 * response. The client can pass that object as-is back to the rollbackVnf
434 * operation to undo the creation.
437 public void rollbackVnfA (VnfRollback rollback, String messageId, String notificationUrl) {
438 // rollback may be null (e.g. if stack already existed when Create was called)
439 if (rollback == null) {
440 logger.info("{} rollbackVnfA: Empty Rollback: No action to perform", MessageEnum.RA_ROLLBACK_NULL);
444 MsoLogger.setLogContext (rollback.getMsoRequest ());
445 logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF);
447 // Use the synchronous method to perform the actual rollback
448 MsoVnfAdapter vnfAdapter = vnfImpl;
451 vnfAdapter.rollbackVnf (rollback);
452 } catch (VnfException e) {
453 logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_ROLLBACK_VNF_ERR,
454 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
455 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
458 eMsg = e.getFaultInfo ().getMessage ();
459 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory.fromValue (e.getFaultInfo ()
462 } catch (Exception e1) {
463 logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
464 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
466 // Build and send Asynchronous error response
468 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
469 notifyPort.rollbackVnfNotification (messageId, false, exCat, eMsg);
470 } catch (Exception e1) {
471 logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
472 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
474 logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE);
478 logger.debug ("Async Rollback VNF:" + rollback.getVnfId ());
479 // Build and send Asynchronous response
481 VnfAdapterNotify notifyPort = getNotifyEP (notificationUrl);
482 notifyPort.rollbackVnfNotification (messageId, true, null, null);
483 } catch (Exception e) {
484 logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
485 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
488 logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE);
492 private org.onap.so.adapters.vnf.async.client.VnfRollback copyVrb (Holder <VnfRollback> hVrb) {
493 org.onap.so.adapters.vnf.async.client.VnfRollback cvrb = new org.onap.so.adapters.vnf.async.client.VnfRollback ();
495 if (hVrb != null && hVrb.value != null) {
496 org.onap.so.adapters.vnf.async.client.MsoRequest cmr = new org.onap.so.adapters.vnf.async.client.MsoRequest ();
498 cvrb.setCloudSiteId (hVrb.value.getCloudSiteId ());
499 if (hVrb.value.getMsoRequest() != null) {
500 cmr.setRequestId (hVrb.value.getMsoRequest ().getRequestId ());
501 cmr.setServiceInstanceId (hVrb.value.getMsoRequest ().getServiceInstanceId ());
503 cmr.setRequestId (null);
504 cmr.setServiceInstanceId (null);
506 cvrb.setMsoRequest (cmr);
507 cvrb.setVnfId (hVrb.value.getVnfId ());
508 cvrb.setTenantId (hVrb.value.getTenantId ());
509 cvrb.setTenantCreated (hVrb.value.getTenantCreated ());
510 cvrb.setVnfCreated (hVrb.value.getVnfCreated ());
515 private CreateVnfNotification.Outputs copyCreateOutputs (Holder <Map <String, String>> hMap) {
517 CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs ();
519 if (hMap != null && hMap.value != null) {
520 Map <String, String> sMap = new HashMap <> ();
522 CreateVnfNotification.Outputs.Entry entry = new CreateVnfNotification.Outputs.Entry ();
524 for (String key : sMap.keySet ()) {
526 entry.setValue (sMap.get (key));
527 outputs.getEntry ().add (entry);
533 private UpdateVnfNotification.Outputs copyUpdateOutputs (Holder <Map <String, String>> hMap) {
535 UpdateVnfNotification.Outputs outputs = new UpdateVnfNotification.Outputs ();
537 if (hMap != null && hMap.value != null) {
538 Map <String, String> sMap = new HashMap <> ();
540 UpdateVnfNotification.Outputs.Entry entry = new UpdateVnfNotification.Outputs.Entry ();
542 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
543 String key = mapEntry.getKey();
544 String value = mapEntry.getValue();
546 entry.setValue (value);
547 outputs.getEntry ().add (entry);
553 private QueryVnfNotification.Outputs copyQueryOutputs (Holder <Map <String, String>> hMap) {
555 QueryVnfNotification.Outputs outputs = new QueryVnfNotification.Outputs ();
557 if (hMap != null && hMap.value != null) {
558 Map <String, String> sMap = new HashMap <> ();
561 QueryVnfNotification.Outputs.Entry entry = new QueryVnfNotification.Outputs.Entry ();
563 for (Map.Entry<String,String> mapEntry : sMap.entrySet ()) {
564 String key = mapEntry.getKey();
565 String value = mapEntry.getValue();
567 entry.setValue (value);
568 outputs.getEntry ().add (entry);
574 private VnfAdapterNotify getNotifyEP (String notificationUrl) {
576 URL warWsdlLoc = null;
578 warWsdlLoc = Thread.currentThread ().getContextClassLoader ().getResource ("VnfAdapterNotify.wsdl");
579 } catch (Exception e) {
580 logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND,
581 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
583 if (warWsdlLoc == null) {
584 logger.error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND,
585 MsoLogger.ErrorCode.BusinessProcesssError.getValue());
588 logger.debug("VnfAdpaterNotify.wsdl location:{}", warWsdlLoc.toURI().toString());
589 } catch (Exception e) {
590 logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC,
591 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
595 VnfAdapterNotify_Service notifySvc = new VnfAdapterNotify_Service (warWsdlLoc,
596 new QName ("http://org.onap.so/vnfNotify",
597 "vnfAdapterNotify"));
599 VnfAdapterNotify notifyPort = notifySvc.getMsoVnfAdapterAsyncImplPort ();
601 BindingProvider bp = (BindingProvider) notifyPort;
605 epUrl = new URL (notificationUrl);
606 } catch (MalformedURLException e1) {
607 logger.error("{} {} MalformedURLException ", MessageEnum.RA_INIT_NOTIF_EXC,
608 MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e1);
612 logger.debug("Notification Endpoint URL: {}", epUrl.toExternalForm());
613 bp.getRequestContext ().put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm ());
616 logger.debug ("epUrl is NULL:");
621 Map <String, Object> reqCtx = bp.getRequestContext ();
622 Map <String, List <String>> headers = new HashMap <> ();
624 String userCredentials = this.getEncryptedProperty(BPEL_AUTH_PROP, "", ENCRYPTION_KEY_PROP);
626 String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ());
627 reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers);
628 headers.put ("Authorization", Collections.singletonList (basicAuth));
629 } catch (Exception e) {
630 logger.error("{} {} Exception - Unable to set authorization in callback request ",
631 MessageEnum.RA_SET_CALLBACK_AUTH_EXC, MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e);
637 public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
639 return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey));
640 } catch (GeneralSecurityException e) {
641 logger.debug("Exception while decrypting property: {} ", this.environment.getProperty(key), e);