public override void ProcessMessage(SoapMessage message) { try { if (message.Stage == SoapMessageStage.AfterDeserialize) { string _mtd = this._processSoap(message); string _userExecute = string.Format("USERID '{0}' ", "unknown"); foreach (SoapHeader header in message.Headers) { if (header is AuthHeader) { AuthHeader credentials = (AuthHeader)header; try { switch (credentials.CryptoAlgorithm) { case AuthHeader.CryptoAlgorithmEnum.NONE: _userExecute = string.Format("USERID '{0}' ", credentials.AuthKey.Split(new char[] { '|' })[0]); break; case AuthHeader.CryptoAlgorithmEnum.TRIPLEDES: _userExecute = string.Format("USERID '{0}' ", CryptorEngineTripleDES.Decrypt(SAFConfiguration.readConnectionStringCoreEncrypted(), new SecurityInfo(SAFConfiguration.readMasterKey(), SAFConfiguration.readInfoKey(), SAFConfiguration.readInfoIV()), true).Split(new char[] { '|' })[0]); break; } } catch (SoapException ex) { SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFAPILOGGER", new string[] { "http://sfexpand.SAFBusiness.AuthExtension.softfinanca.com/", ex.ToString() }); } } } SAFLOGGER.dump(SAFLOGGER.LOGGEREventID.INFORMATION, "SAFAPILOGGER", new string[] { _userExecute + _mtd }); } } catch { } }
public NotifyOperationResult SendNotification(NotificationEvent notificationEvent, out int returnStatus) { returnStatus = 0; NotifyOperationResult result; try { string[] _gatewayParams = notificationEvent.NotificationChannelInfo.ChannelBaseParameters.Split(new char[] { '|' }); if (MSMQHELPER.sendMQMessage(_gatewayParams[0], _gatewayParams[1], new string[] { notificationEvent.NotificationDestination, notificationEvent.NotificationMessageSubject, notificationEvent.NotificationMessageContent, notificationEvent.NotificationFrom, "http://sfexpand.EMAILConnectorSF.EMAILConnector.softfinanca.com/" })) { SAFLOGGER.dump(SAFLOGGER.LOGGEREventID.INFORMATION, "EMAILCONNECTOR", new string[] { "http://sfexpand.EMAILConnectorSF.EMAILConnector.softfinanca.com/", "[OK] Message sended to destination:" + notificationEvent.NotificationDestination.Trim() }); result = NotifyOperationResult.Success; } else { SAFLOGGER.dump(SAFLOGGER.LOGGEREventID.ERROR, "EMAILCONNECTOR", new string[] { "http://sfexpand.EMAILConnectorSF.EMAILConnector.softfinanca.com/", "[NOK] Error wile send message to destination:" + notificationEvent.NotificationDestination.Trim() }); result = NotifyOperationResult.Error; } } catch (Exception ex) { SAFLOGGER.dump(SAFLOGGER.LOGGEREventID.EXCEPTION, "EMAILCONNECTOR", new string[] { "http://sfexpand.EMAILConnectorSF.EMAILConnector.softfinanca.com/", "[NOK] Error wile send message to destination:" + notificationEvent.NotificationDestination.Trim(), ex.ToString() }); result = NotifyOperationResult.Error; } return(result); }
public NotifyOperationResult SendNotification(NotificationEvent notificationEvent, out int returnStatus) { returnStatus = 0; DateTime startTime = DateTime.Now; readFileBean proxy = new readFileBean(); string[] _gatewayParams = null; SAFLOGGER.dump(SAFLOGGER.LOGGEREventID.INFORMATION, "SMSCONNECTOR", new string[] { "http://sfexpand.SMSConnector.SMSConnectorST.softfinanca.com/", "from='" + notificationEvent.NotificationFrom + "'", "destination='" + notificationEvent.NotificationDestination, "message='" + notificationEvent.NotificationMessageContent }); NotifyOperationResult result; if (notificationEvent.NotificationDestination == null || notificationEvent.NotificationDestination.Trim().Length < 9) { SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.ERROR, "SMSCONNECTOR", new string[] { "http://sfexpand.SMSConnector.SMSConnectorST.softfinanca.com/", Assembly.GetExecutingAssembly().FullName.ToString(), "Invalid or inexistent phone number field!" }); result = NotifyOperationResult.DestinationsToNotifyNotFound; } else { _gatewayParams = notificationEvent.NotificationChannelInfo.ChannelBaseParameters.Split(new char[] { '|' }); string _tmpMsg = notificationEvent.NotificationMessageContent.Replace("\"", "%22").Replace("&", "%26").Replace("'", "%27").Replace("<", "%3C").Replace(">", "%3E"); if (1 == _tmpMsg.CompareTo(notificationEvent.NotificationMessageContent)) { SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.WARNING, "SMSCONNECTOR", new string[] { "http://sfexpand.SMSConnector.SMSConnectorST.softfinanca.com/", "not allowed characters found! MESSAGE CONTENT REPLACED!" }); } if (_tmpMsg.Length > 160) { _tmpMsg = _tmpMsg.Substring(0, 160); SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.WARNING, "SMSCONNECTOR", new string[] { "http://sfexpand.SMSConnector.SMSConnectorST.softfinanca.com/", " Message length exceeded 160 Chars! MESSAGE TRUNCATED!" }); } try { proxy.Url = _gatewayParams[0]; proxy.Credentials = CredentialCache.DefaultNetworkCredentials; proxy.Timeout = ((notificationEvent.NotificationChannelInfo.ChannelTimout > 1000) ? notificationEvent.NotificationChannelInfo.ChannelTimout : 3000); proxy.SoapVersion = SoapProtocolVersion.Soap11; SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.INFORMATION, "SMSCONNECTOR", new string[] { "http://sfexpand.SMSConnector.SMSConnectorST.softfinanca.com/", "Service end point[" + _gatewayParams[1] + "]", "End point timeout[" + proxy.Timeout.ToString() + "]" }); proxy.sendMobSMS(notificationEvent.NotificationDestination.Trim(), _tmpMsg); result = NotifyOperationResult.Success; } catch (Exception ex) { SAFLOGGER.dump(SAFLOGGER.LOGGEREventID.ERROR, "SMSCONNECTOR", new string[] { "http://sfexpand.SMSConnector.SMSConnectorST.softfinanca.com/", Assembly.GetExecutingAssembly().FullName.ToString(), "ERROR! Message was not send!", ex.ToString() }); result = ((ex.Message.IndexOf("timed out") > 0) ? NotifyOperationResult.ChannelProcessorError : NotifyOperationResult.ChannelProcessorError); } finally { SAFLOGGER.dump(SAFLOGGER.LOGGEREventID.INFORMATION, "SMSCONNECTOR", new string[] { "http://sfexpand.SMSConnector.SMSConnectorST.softfinanca.com/", "Service :: [", _gatewayParams[0] + "] :: took [" + (DateTime.Now - startTime).TotalSeconds.ToString() + " sec]" }); if (proxy != null) { proxy.Dispose(); } proxy = null; } } return(result); }