Exemple #1
0
        public DistributionStatus CheckDistibutionStatusV3(string distributionId)
        {
            var client = new MessagePortv3Client();

            DistributionStatus[] result = null;

            try
            {
                //Call method.
                result = client.checkDistributionStatus(ConfigHelper.SenderOrganizationNumber, distributionId);
            }
            catch (Exception ex)
            {
                // in case of exception, log and call Abort
                string errorMessage = string.Format("SE.GOV.MM.Integration.Delivery.DataLayer: Error checking distributionstatus for distributionId: {0}, ExceptionMessage: {1}", distributionId, ex.Message);
                LogManager.Log(new Log.Log()
                {
                    EventId = EventId.CommunicationExceptionWithMessage, Exception = ex, Level = Level.Error, Message = errorMessage
                });
                client.Abort();
            }
            finally
            {
                client.Close();
            }
            LogManager.LogTrace(string.Format("Checked distribution status for id: {0}", distributionId));
            LogManager.LogTrace(string.Format("The result was: {0}, and the result list: {1}", result[0], result));

            return(result != null ? result[0] : null);
        }
Exemple #2
0
        public string DistributeSecureV3(SignedDelivery1 message, Guid requestId)
        {
            LogManager.LogTrace(string.Format("SE.GOV.MM.Integration.Package.DataLayer.Service: incoming DistributeSecureV3 with RequestId: {0}", requestId));

            MessagePortv3Client client = null;
            string result = string.Empty;

            try
            {
                client = new MessagePortv3Client("MessagePortV3");
                //Call method.
                result = client.distributeSecure(message);
            }
            catch (Exception ex)
            {
                string errorMessage = string.Format("SE.GOV.MM.Integration.Package.Service.MessageService: Exception have been thrown when calling servicemethod DistributeSecureV3. Recipient: {0}, RequestId: {1}", message.Delivery.Header.Recipient, requestId);
                LogManager.Log(new Log.Log()
                {
                    Message = errorMessage, EventId = EventId.CommunicationExceptionWithMessage, Exception = ex, Level = Level.Error
                });
                throw ex;
            }
            finally
            {
                if (client != null && client.State == CommunicationState.Faulted)
                {
                    client.Abort();
                    client.Close();
                }
                client = null;
            }
            LogManager.LogTrace(string.Format("SE.GOV.MM.Integration.Package.DataLayer.Service: leaving DistributeSecureV3 with RequestId: {0}", requestId));
            return(result);
        }