/**
         *  Determine a file name from the interaction id and the message id, and write the received message to it.
         */
        public void handle(Sendable s)
        {
            StringBuilder sb = new StringBuilder(spoolDirectory);
            sb.Append("\\");
            sb.Append(getLastServiceURIElement(s.SoapAction));
            sb.Append("_");
            sb.Append(getFileSafeMessageID(s.getMessageId()));
            sb.Append(".message");
            string filename = sb.ToString();

            try
            {
                using (FileStream fs = new FileStream(filename, FileMode.Create))
                {
                    using (StreamWriter sw = new StreamWriter(fs))
                    {
                        sw.Write(s.getHl7Payload());
                        sw.Flush();
                        sw.Close();
                    }
                }
            }
            catch (Exception e)
            {
                EventLog ev = new EventLog("Application");
                ev.Source = LOGSOURCE;
                StringBuilder sbe = new StringBuilder("Failed to save response ");
                sbe.Append(s.getMessageId());
                sbe.Append(" service ");
                sbe.Append(s.SoapAction);
                sbe.Append(". Reason: ");
                sbe.Append(e.ToString());
                ev.WriteEntry(sbe.ToString(), EventLogEntryType.Error);
            }
        }
 public void handle(Sendable s)
 {
     EbXmlMessage ebxml = (EbXmlMessage)s;
     ITKDistributionEnvelopeAttachment a = (ITKDistributionEnvelopeAttachment)ebxml.Attachments[ITKATTACHMENT];
     DistributionEnvelope d = a.DistributionEnvelope;
     IDistributionEnvelopeHandler h = null;
     try
     {
         h = handlers[d.getService()];
     }
     catch (KeyNotFoundException)
     {
         EventLog logger = new EventLog("Application");
         logger.Source = LOGSOURCE;
         StringBuilder sb = new StringBuilder("No explicit handler found for ");
         sb.Append(d.getService());
         sb.Append(" using default DefaultFileSaveDistributionEnvelopeHandler instead");
         logger.WriteEntry(sb.ToString(), EventLogEntryType.Warning);
         h = new DefaultFileSaveDistributionEnvelopeHandler();
     }
     h.handle(d);
 }
Exemplo n.º 3
0
        public void handle(Sendable s)
        {
            EbXmlMessage ebxml = (EbXmlMessage)s;
            ITKDistributionEnvelopeAttachment a = (ITKDistributionEnvelopeAttachment)ebxml.Attachments[ITKATTACHMENT];
            DistributionEnvelope         d      = a.DistributionEnvelope;
            IDistributionEnvelopeHandler h      = null;

            try
            {
                h = handlers[d.getService()];
            }
            catch (KeyNotFoundException)
            {
                EventLog logger = new EventLog("Application");
                logger.Source = LOGSOURCE;
                StringBuilder sb = new StringBuilder("No explicit handler found for ");
                sb.Append(d.getService());
                sb.Append(" using default DefaultFileSaveDistributionEnvelopeHandler instead");
                logger.WriteEntry(sb.ToString(), EventLogEntryType.Warning);
                h = new DefaultFileSaveDistributionEnvelopeHandler();
            }
            h.handle(d);
        }
Exemplo n.º 4
0
        /**
         *  Determine a file name from the interaction id and the message id, and write the received message to it.
         */
        public void handle(Sendable s)
        {
            StringBuilder sb = new StringBuilder(spoolDirectory);

            sb.Append("\\");
            sb.Append(getLastServiceURIElement(s.SoapAction));
            sb.Append("_");
            sb.Append(getFileSafeMessageID(s.getMessageId()));
            sb.Append(".message");
            string filename = sb.ToString();

            try
            {
                using (FileStream fs = new FileStream(filename, FileMode.Create))
                {
                    using (StreamWriter sw = new StreamWriter(fs))
                    {
                        sw.Write(s.getHl7Payload());
                        sw.Flush();
                        sw.Close();
                    }
                }
            }
            catch (Exception e)
            {
                EventLog ev = new EventLog("Application");
                ev.Source = LOGSOURCE;
                StringBuilder sbe = new StringBuilder("Failed to save response ");
                sbe.Append(s.getMessageId());
                sbe.Append(" service ");
                sbe.Append(s.SoapAction);
                sbe.Append(". Reason: ");
                sbe.Append(e.ToString());
                ev.WriteEntry(sbe.ToString(), EventLogEntryType.Error);
            }
        }
Exemplo n.º 5
0
 public abstract void setResponse(Sendable r);
Exemplo n.º 6
0
 public override void setResponse(Sendable r)
 {
 }
 public override void setResponse(Sendable r)
 {
 }
Exemplo n.º 8
0
 public abstract void setResponse(Sendable r);
Exemplo n.º 9
0
 public override void setResponse(Sendable r)
 {
     response = (EbXmlMessage)r;
 }
Exemplo n.º 10
0
 public override void setResponse(Sendable r)
 {
     response = (EbXmlMessage)r;
 }