Search in sources :

Example 11 with WebServiceSecurityException

use of org.opensmartgridplatform.shared.exceptionhandling.WebServiceSecurityException in project open-smart-grid-platform by OSGP.

the class CoreNotificationService method doSendNotification.

private void doSendNotification(final NotificationType notificationType, final String organisationIdentification, final String deviceIdentification, final String correlationUid, final String result, final String message) {
    final Notification notification = new Notification();
    // Required fields.
    notification.setNotificationType(notificationType);
    notification.setDeviceIdentification(deviceIdentification);
    // Optional fields.
    if (!StringUtils.isEmpty(correlationUid)) {
        notification.setCorrelationUid(correlationUid);
    }
    if (!StringUtils.isEmpty(result)) {
        notification.setResult(OsgpResultType.valueOf(result));
    }
    if (!StringUtils.isEmpty(message)) {
        notification.setMessage(message);
    }
    // Try to send notification and catch security exceptions.
    try {
        this.sendNotificationServiceClient.sendNotification(organisationIdentification, notification);
    } catch (final WebServiceSecurityException e) {
        LOGGER.error("Unable to send notification", e);
    }
}
Also used : Notification(org.opensmartgridplatform.adapter.ws.schema.core.notification.Notification) WebServiceSecurityException(org.opensmartgridplatform.shared.exceptionhandling.WebServiceSecurityException)

Aggregations

WebServiceSecurityException (org.opensmartgridplatform.shared.exceptionhandling.WebServiceSecurityException)11 When (io.cucumber.java.en.When)3 GeneralSecurityException (java.security.GeneralSecurityException)3 ReadSettingsHelper.getString (org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString)3 SoapFaultClientException (org.springframework.ws.soap.client.SoapFaultClientException)3 Then (io.cucumber.java.en.Then)2 IOException (java.io.IOException)2 Notification (org.opensmartgridplatform.adapter.ws.schema.core.notification.Notification)2 KeyStore (java.security.KeyStore)1 KeyStoreException (java.security.KeyStoreException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 RequestConfig (org.apache.http.client.config.RequestConfig)1 SSLConnectionSocketFactory (org.apache.http.conn.ssl.SSLConnectionSocketFactory)1 SSLContextBuilder (org.apache.http.conn.ssl.SSLContextBuilder)1 HttpClientBuilder (org.apache.http.impl.client.HttpClientBuilder)1 Instant (org.joda.time.Instant)1 OsgpResultType (org.opensmartgridplatform.adapter.ws.schema.core.common.OsgpResultType)1 Device (org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.Device)1