Ejemplo n.º 1
0
        /**
         * Construct an EbXmlMessage for sending.
         *
         * @param s An SdSTransmissionDetails instance for recipient information
         * @param m SpineHL7Message instance to be sent
         * @param c Reference to an SDSconnection for resolving URLs
         */
        public EbXmlMessage(SdsTransmissionDetails s, SpineHL7Message m)
        {
            SDSconnection c = ConnectionManager.getInstance().SdsConnection;

            odsCode    = s.Org;
            header     = new EbXmlHeader(this, s);
            type       = EBXML;
            hl7message = m;
            string svcurl = c.resolveUrl(s.SvcIA);

            if (svcurl == null)
            {
                resolvedUrl = s.Url;
            }
            else
            {
                resolvedUrl = svcurl;
            }
            if (s.Retries != SdsTransmissionDetails.NOT_SET)
            {
                retryCount       = s.Retries;
                minRetryInterval = s.RetryInterval;
                persistDuration  = s.PersistDuration;
            }
            attachments = new List <Attachment>();
            persistable = (s.Retries > 0);
        }
Ejemplo n.º 2
0
        /**
         * Construct a SpineSOAPRequest for sending.
         *
         * @param s An SdSTransmissionDetails instance for recipient information
         * @param m SpineHL7Message instance to be sent
         * @param c Reference to an SDSconnection for resolving URLs
         */
        public SpineSOAPRequest(SdsTransmissionDetails s, SpineHL7Message m)
        {
            if (bootException != null)
            {
                throw bootException;
            }
            SDSconnection c = ConnectionManager.getInstance().SdsConnection;

            type      = Sendable.SOAP;
            myAsid    = c.MyAsid;
            messageid = Guid.NewGuid().ToString().ToUpper();
            lock (messageid)
            {
                if (myIp == null)
                {
                    ConnectionManager cm = ConnectionManager.getInstance();
                    if (cm.MyIp == null)
                    {
                        try
                        {
                            IPAddress[] addresses = Dns.GetHostAddresses("");
                            myIp = addresses[0].ToString();
                        }
                        catch (Exception e)
                        {
                            bootException = e;
                            throw e;
                        }
                        if (myIp == null)
                        {
                            bootException = new Exception("No non-localhost IP interfaces found");
                            throw bootException;
                        }
                    }
                    else
                    {
                        myIp = cm.MyIp;
                    }
                }
                if (template == null)
                {
                    Assembly      assembly = Assembly.GetExecutingAssembly();
                    StreamReader  sr       = new StreamReader(assembly.GetManifestResourceStream(SOAPREQUESTTEMPLATE));
                    StringBuilder sb       = new StringBuilder();
                    try
                    {
                        String line = null;
                        while ((line = sr.ReadLine()) != null)
                        {
                            sb.Append(line);
                            sb.Append("\r\n");
                        }
                        template = sb.ToString();
                    }
                    catch (Exception e)
                    {
                        bootException = e;
                        throw e;
                    }
                }
            }
            transmissionDetails = s;
            hl7Message          = m;
            string svcurl = c.resolveUrl(s.SvcIA);

            if (svcurl == null)
            {
                resolvedUrl = s.Url;
            }
            else
            {
                resolvedUrl = svcurl;
            }
        }