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",
59 targetNamespace = "http://org.onap.so/vnfA")
61 public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
63 private static final Logger logger = LoggerFactory.getLogger(MsoVnfAdapterAsyncImpl.class);
65 private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth";
66 private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey";
69 private Environment environment;
72 private MsoVnfAdapterImpl vnfImpl;
75 * Health Check web method. Does nothing but return to show the adapter is deployed.
78 public void healthCheckA() {
79 logger.debug("Health check call in VNF Adapter");
83 * This is the asynchronous "Create VNF" web service implementation. It will create a new VNF of the requested type
84 * in the specified cloud 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 success or failure, depending on the value
87 * of the 'failIfExists' parameter.
89 * All VNF types will be defined in the MSO catalog. The caller must request one of these pre-defined types or an
90 * error will be returned. Within the catalog, each VNF type references (among other things) a Heat template which
91 * is used to deploy the required VNF artifacts (VMs, networks, etc.) to the cloud.
93 * Depending on the Heat template, a variable set of input parameters will be defined, some of which are required.
94 * The caller is responsible to pass the necessary input data for the VNF or an error will be thrown.
96 * The method sends an asynchronous response to the notification URL when processing completes. The
97 * createAsyncResponse contains the vnfId (the canonical name of the stack), a Map of VNF output attributes, and a
98 * VnfRollback object. This last object can be passed as-is to the rollbackVnf operation to undo everything that was
99 * created for the VNF. This is useful if a VNF is successfully created but the orchestrator fails on a subsequent
102 * Note: this method is implemented by calling the synchronous web method and translating the response to an
103 * asynchronous notification.
105 * @param cloudSiteId CLLI code of the cloud site in which to create the VNF
106 * @param cloudOwner cloud owner of the cloud site in which to create the VNF
107 * @param tenantId Openstack tenant identifier
108 * @param vnfType VNF type key, should match a VNF definition in catalog DB
109 * @param vnfName Name to be assigned to the new VNF
110 * @param inputs Map of key=value inputs for VNF stack creation
111 * @param failIfExists Flag whether already existing VNF should be considered a success or failure
112 * @param msoRequest Request tracking information for logs
113 * @param notificationURL the target URL for asynchronous response
116 public void createVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion,
117 String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
118 Boolean failIfExists, Boolean backout, Boolean enableBridge, String messageId, MsoRequest msoRequest,
119 String notificationUrl) {
121 logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF);
122 // Use the synchronous method to perform the actual Create
123 MsoVnfAdapter vnfAdapter = vnfImpl;
124 // Synchronous Web Service Outputs
125 Holder<String> vnfId = new Holder<>();
126 Holder<Map<String, String>> outputs = new Holder<>();
127 Holder<VnfRollback> vnfRollback = new Holder<>();
130 vnfAdapter.createVnf(cloudSiteId, cloudOwner, tenantId, vnfType, vnfVersion, vnfName, requestType,
131 volumeGroupHeatStackId, inputs, failIfExists, backout, enableBridge, msoRequest, vnfId, outputs,
133 } catch (VnfException e) {
134 logger.error("{} {} VnfException in createVnfA ", MessageEnum.RA_CREATE_VNF_ERR,
135 ErrorCode.BusinessProcesssError.getValue(), e);
136 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
139 eMsg = e.getFaultInfo().getMessage();
140 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory
141 .fromValue(e.getFaultInfo().getCategory().name());
142 } catch (Exception e1) {
143 logger.error("{} {} Exception - Fault info ", MessageEnum.RA_FAULT_INFO_EXC,
144 ErrorCode.BusinessProcesssError.getValue(), e1);
146 // Build and send Asynchronous error response
148 VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
149 notifyPort.createVnfNotification(messageId, false, exCat, eMsg, null, null, null);
150 } catch (Exception e1) {
151 logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
152 ErrorCode.BusinessProcesssError.getValue(), e1);
154 logger.info("{}", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
157 logger.debug("Async Create VNF: {} VnfId:{}", vnfName, vnfId.value);
158 // Build and send Asynchronous response
160 VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
161 notifyPort.createVnfNotification(messageId, true, null, null, vnfId.value, copyCreateOutputs(outputs),
162 copyVrb(vnfRollback));
163 } catch (Exception e) {
164 logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
165 ErrorCode.BusinessProcesssError.getValue(), e);
167 logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
172 public void updateVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion,
173 String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
174 String messageId, MsoRequest msoRequest, String notificationUrl) {
176 logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF);
178 // Use the synchronous method to perform the actual Create
179 MsoVnfAdapter vnfAdapter = vnfImpl;
181 // Synchronous Web Service Outputs
182 Holder<String> vnfId = new Holder<>();
183 Holder<Map<String, String>> outputs = new Holder<>();
184 Holder<VnfRollback> vnfRollback = new Holder<>();
187 vnfAdapter.updateVnf(cloudSiteId, cloudOwner, tenantId, vnfType, vnfVersion, vnfName, requestType,
188 volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback);
189 } catch (VnfException e) {
190 logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_UPDATE_VNF_ERR,
191 ErrorCode.BusinessProcesssError.getValue(), e);
192 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
195 eMsg = e.getFaultInfo().getMessage();
196 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory
197 .fromValue(e.getFaultInfo().getCategory().name());
198 } catch (Exception e1) {
199 logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
200 ErrorCode.BusinessProcesssError.getValue(), e1);
202 // Build and send Asynchronous error response
204 VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
205 notifyPort.updateVnfNotification(messageId, false, exCat, eMsg, null, null);
206 } catch (Exception e1) {
207 logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
208 ErrorCode.BusinessProcesssError.getValue(), e1);
210 logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
213 logger.debug("Async Update VNF: {} VnfId:{}", vnfName, vnfId.value);
214 // Build and send Asynchronous response
216 VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
217 notifyPort.updateVnfNotification(messageId, true, null, null, copyUpdateOutputs(outputs),
218 copyVrb(vnfRollback));
219 } catch (Exception e) {
220 logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
221 ErrorCode.BusinessProcesssError.getValue(), e);
223 logger.info("{} UpdateVnfA", MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
228 * This is the "Query VNF" web service implementation. It will look up a VNF by name or ID in the specified cloud
231 * The method returns an indicator that the VNF exists, its Openstack internal ID, its status, and the set of
232 * outputs (from when the stack was created).
234 * @param cloudSiteId CLLI code of the cloud site in which to query
235 * @param cloudOwner cloud owner of cloud site in which to query
236 * @param tenantId Openstack tenant identifier
237 * @param vnfName VNF Name or Openstack ID
238 * @param msoRequest Request tracking information for logs
239 * @param notificationURL the target URL for asynchronous response
242 public void queryVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String messageId,
243 MsoRequest msoRequest, String notificationUrl) {
245 String serviceName = "QueryVnfA";
246 logger.info("{}", MessageEnum.RA_ASYNC_QUERY_VNF);
248 // Use the synchronous method to perform the actual query
249 MsoVnfAdapter vnfAdapter = vnfImpl;
251 // Synchronous Web Service Outputs
252 Holder<Boolean> vnfExists = new Holder<>();
253 Holder<String> vnfId = new Holder<>();
254 Holder<VnfStatus> status = new Holder<>();
255 Holder<Map<String, String>> outputs = new Holder<>();
258 vnfAdapter.queryVnf(cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest, vnfExists, vnfId, status,
260 } catch (VnfException e) {
261 logger.error("{} {} Exception sending queryVnfA notification ", MessageEnum.RA_QUERY_VNF_ERR,
262 ErrorCode.BusinessProcesssError.getValue(), e);
263 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
266 eMsg = e.getFaultInfo().getMessage();
267 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory
268 .fromValue(e.getFaultInfo().getCategory().name());
269 } catch (Exception e1) {
270 logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
271 ErrorCode.BusinessProcesssError.getValue(), e1);
273 // Build and send Asynchronous error response
275 VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
276 notifyPort.queryVnfNotification(messageId, false, exCat, eMsg, null, null, null, null);
277 } catch (Exception e1) {
278 logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
279 ErrorCode.BusinessProcesssError.getValue(), e1);
281 logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE);
285 if (!vnfExists.value) {
286 logger.debug("Async Query, VNF not found");
288 logger.debug("Async Query, VNF={}, status={}", vnfId.value, status.value);
290 // Build and send Asynchronous response
292 VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
293 org.onap.so.adapters.vnf.async.client.VnfStatus vnfS =
294 org.onap.so.adapters.vnf.async.client.VnfStatus.fromValue(status.value.name());
295 notifyPort.queryVnfNotification(messageId, true, null, null, vnfExists.value, vnfId.value, vnfS,
296 copyQueryOutputs(outputs));
297 } catch (Exception e) {
298 logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
299 ErrorCode.BusinessProcesssError.getValue(), e);
302 logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE);
307 * This is the Asynchronous "Delete VNF" web service implementation. It will delete a VNF by name or ID in the
308 * specified cloud and tenant.
310 * The method has no outputs.
312 * @param cloudSiteId CLLI code of the cloud site in which to delete
313 * @param cloudOwner cloud owner of cloud site in which to delete
314 * @param tenantId Openstack tenant identifier
315 * @param vnfName VNF Name or Openstack ID
316 * @param msoRequest Request tracking information for logs
317 * @param notificationURL the target URL for asynchronous response
320 public void deleteVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String messageId,
321 MsoRequest msoRequest, String notificationUrl) {
323 String serviceName = "DeleteVnfA";
324 logger.info("{}", MessageEnum.RA_ASYNC_DELETE_VNF);
326 // Use the synchronous method to perform the actual delete
327 MsoVnfAdapter vnfAdapter = vnfImpl;
330 vnfAdapter.deleteVnf(cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest);
331 } catch (VnfException e) {
332 logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR,
333 ErrorCode.BusinessProcesssError.getValue(), e);
334 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
337 eMsg = e.getFaultInfo().getMessage();
338 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory
339 .fromValue(e.getFaultInfo().getCategory().name());
340 } catch (Exception e1) {
341 logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
342 ErrorCode.BusinessProcesssError.getValue(), e1);
344 // Build and send Asynchronous error response
346 VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
347 notifyPort.deleteVnfNotification(messageId, false, exCat, eMsg);
348 } catch (Exception e1) {
349 logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
350 ErrorCode.BusinessProcesssError.getValue(), e1);
352 logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE);
356 logger.debug("Async Delete VNF: {}", vnfName);
357 // Build and send Asynchronous response
359 VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
360 notifyPort.deleteVnfNotification(messageId, true, null, null);
362 } catch (Exception e) {
363 logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
364 ErrorCode.BusinessProcesssError.getValue(), e);
367 logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE);
372 * This web service endpoint will rollback a previous Create VNF operation. A rollback object is returned to the
373 * client in a successful creation response. The client can pass that object as-is back to the rollbackVnf operation
374 * to undo the creation.
377 public void rollbackVnfA(VnfRollback rollback, String messageId, String notificationUrl) {
378 // rollback may be null (e.g. if stack already existed when Create was called)
379 if (rollback == null) {
380 logger.info("{} rollbackVnfA: Empty Rollback: No action to perform", MessageEnum.RA_ROLLBACK_NULL);
384 logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF);
386 // Use the synchronous method to perform the actual rollback
387 MsoVnfAdapter vnfAdapter = vnfImpl;
390 vnfAdapter.rollbackVnf(rollback);
391 } catch (VnfException e) {
392 logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_ROLLBACK_VNF_ERR,
393 ErrorCode.BusinessProcesssError.getValue(), e);
394 org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
397 eMsg = e.getFaultInfo().getMessage();
398 exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory
399 .fromValue(e.getFaultInfo().getCategory().name());
400 } catch (Exception e1) {
401 logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
402 ErrorCode.BusinessProcesssError.getValue(), e1);
404 // Build and send Asynchronous error response
406 VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
407 notifyPort.rollbackVnfNotification(messageId, false, exCat, eMsg);
408 } catch (Exception e1) {
409 logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
410 ErrorCode.BusinessProcesssError.getValue(), e1);
412 logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE);
416 logger.debug("Async Rollback VNF:" + rollback.getVnfId());
417 // Build and send Asynchronous response
419 VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
420 notifyPort.rollbackVnfNotification(messageId, true, null, null);
421 } catch (Exception e) {
422 logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
423 ErrorCode.BusinessProcesssError.getValue(), e);
426 logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE);
430 private org.onap.so.adapters.vnf.async.client.VnfRollback copyVrb(Holder<VnfRollback> hVrb) {
431 org.onap.so.adapters.vnf.async.client.VnfRollback cvrb =
432 new org.onap.so.adapters.vnf.async.client.VnfRollback();
434 if (hVrb != null && hVrb.value != null) {
435 org.onap.so.adapters.vnf.async.client.MsoRequest cmr =
436 new org.onap.so.adapters.vnf.async.client.MsoRequest();
438 cvrb.setCloudSiteId(hVrb.value.getCloudSiteId());
439 if (hVrb.value.getMsoRequest() != null) {
440 cmr.setRequestId(hVrb.value.getMsoRequest().getRequestId());
441 cmr.setServiceInstanceId(hVrb.value.getMsoRequest().getServiceInstanceId());
443 cmr.setRequestId(null);
444 cmr.setServiceInstanceId(null);
446 cvrb.setMsoRequest(cmr);
447 cvrb.setVnfId(hVrb.value.getVnfId());
448 cvrb.setTenantId(hVrb.value.getTenantId());
449 cvrb.setTenantCreated(hVrb.value.getTenantCreated());
450 cvrb.setVnfCreated(hVrb.value.getVnfCreated());
455 private CreateVnfNotification.Outputs copyCreateOutputs(Holder<Map<String, String>> hMap) {
457 CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs();
459 if (hMap != null && hMap.value != null) {
460 Map<String, String> sMap = new HashMap<>();
462 CreateVnfNotification.Outputs.Entry entry = new CreateVnfNotification.Outputs.Entry();
464 for (String key : sMap.keySet()) {
466 entry.setValue(sMap.get(key));
467 outputs.getEntry().add(entry);
473 private UpdateVnfNotification.Outputs copyUpdateOutputs(Holder<Map<String, String>> hMap) {
475 UpdateVnfNotification.Outputs outputs = new UpdateVnfNotification.Outputs();
477 if (hMap != null && hMap.value != null) {
478 Map<String, String> sMap = new HashMap<>();
480 UpdateVnfNotification.Outputs.Entry entry = new UpdateVnfNotification.Outputs.Entry();
482 for (Map.Entry<String, String> mapEntry : sMap.entrySet()) {
483 String key = mapEntry.getKey();
484 String value = mapEntry.getValue();
486 entry.setValue(value);
487 outputs.getEntry().add(entry);
493 private QueryVnfNotification.Outputs copyQueryOutputs(Holder<Map<String, String>> hMap) {
495 QueryVnfNotification.Outputs outputs = new QueryVnfNotification.Outputs();
497 if (hMap != null && hMap.value != null) {
498 Map<String, String> sMap = new HashMap<>();
501 QueryVnfNotification.Outputs.Entry entry = new QueryVnfNotification.Outputs.Entry();
503 for (Map.Entry<String, String> mapEntry : sMap.entrySet()) {
504 String key = mapEntry.getKey();
505 String value = mapEntry.getValue();
507 entry.setValue(value);
508 outputs.getEntry().add(entry);
514 private VnfAdapterNotify getNotifyEP(String notificationUrl) {
516 URL warWsdlLoc = null;
518 warWsdlLoc = Thread.currentThread().getContextClassLoader().getResource("VnfAdapterNotify.wsdl");
519 } catch (Exception e) {
520 logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND,
521 ErrorCode.BusinessProcesssError.getValue(), e);
523 if (warWsdlLoc == null) {
524 logger.error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND,
525 ErrorCode.BusinessProcesssError.getValue());
528 logger.debug("VnfAdpaterNotify.wsdl location:{}", warWsdlLoc.toURI().toString());
529 } catch (Exception e) {
530 logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC,
531 ErrorCode.BusinessProcesssError.getValue(), e);
535 VnfAdapterNotify_Service notifySvc =
536 new VnfAdapterNotify_Service(warWsdlLoc, new QName("http://org.onap.so/vnfNotify", "vnfAdapterNotify"));
538 VnfAdapterNotify notifyPort = notifySvc.getMsoVnfAdapterAsyncImplPort();
540 BindingProvider bp = (BindingProvider) notifyPort;
544 epUrl = new URL(notificationUrl);
545 } catch (MalformedURLException e1) {
546 logger.error("{} {} MalformedURLException ", MessageEnum.RA_INIT_NOTIF_EXC,
547 ErrorCode.BusinessProcesssError.getValue(), e1);
551 logger.debug("Notification Endpoint URL: {}", epUrl.toExternalForm());
552 bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm());
554 logger.debug("epUrl is NULL:");
559 Map<String, Object> reqCtx = bp.getRequestContext();
560 Map<String, List<String>> headers = new HashMap<>();
562 String userCredentials = this.getEncryptedProperty(BPEL_AUTH_PROP, "", ENCRYPTION_KEY_PROP);
564 String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes());
565 reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
566 headers.put("Authorization", Collections.singletonList(basicAuth));
567 } catch (Exception e) {
568 logger.error("{} {} Exception - Unable to set authorization in callback request ",
569 MessageEnum.RA_SET_CALLBACK_AUTH_EXC, ErrorCode.BusinessProcesssError.getValue(), e);
575 public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
577 return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey));
578 } catch (GeneralSecurityException e) {
579 logger.debug("Exception while decrypting property: {} ", this.environment.getProperty(key), e);