Ejemplo n.º 1
0
        public XmlDocument CompressClaim()
        {
            _loggingService.LogInfo(this, "Compressing Claim.");

            XmlElement  bodyElement  = _govTalkMessageBuilder.GovTalkMessage.Body.Any[0];
            XmlDocument bodyDocument = new XmlDocument();

            bodyDocument.LoadXml(bodyElement.OuterXml);

            //deserialize body
            IRenvelope irEnvelope = XmlSerializationHelpers.DeserializeIRenvelope(bodyDocument);

            R68         uncompressedR68 = irEnvelope.R68;
            XmlDocument r68xmlDoc       = XmlSerializationHelpers.SerializeItem(uncompressedR68);

            System.Xml.XmlDocument claimXmlDoc = GovTalkMessageHelper.GetClaim(r68xmlDoc);

            irEnvelope.R68.Items = null;

            R68CompressedPart compressedPart = new R68CompressedPart();

            compressedPart.Type  = R68CompressedPartType.gzip;
            compressedPart.Value = CommonUtilityHelper.CompressData(claimXmlDoc.OuterXml, _loggingService);

            R68CompressedPart[] compressedParts = new R68CompressedPart[1];
            compressedParts[0] = compressedPart;

            irEnvelope.R68.Items = compressedParts;

            bodyElement = XmlSerializationHelpers.SerializeIREnvelope(irEnvelope);

            _govTalkMessageBuilder.GovTalkMessage.Body.Any[0] = null;
            _govTalkMessageBuilder.GovTalkMessage.Body.Any[0] = bodyElement;

            XmlDocument compressedVersion = SerializeGovTalkMessage();

            return(compressedVersion);
        }
Ejemplo n.º 2
0
        public override void SetItems()
        {
            RepaymentBuilder dtRepaymenBuilder = new RepaymentBuilder(_loggingService);

            R68ClaimCreator r68ClaimCreator = new R68ClaimCreator(dtRepaymenBuilder);

            r68ClaimCreator.CreateR68Claim();

            R68Claim[] r68claim = new R68Claim[1];
            r68claim[0] = r68ClaimCreator.GetR68Claim();

            R68.Items = r68claim;

            // Serialize R68 to get XmlDocument with Claim element

            System.Xml.XmlDocument r68xmlDoc = XmlSerializationHelpers.SerializeItem(R68);

            // Then extract Claim itself

            System.Xml.XmlDocument claimXmlDoc = GovTalkMessageHelper.GetClaim(r68xmlDoc);

            // Reset R68 Items

            R68.Items = null;

            // Gzip compress

            R68CompressedPart compressedPart = new R68CompressedPart();

            compressedPart.Type  = R68CompressedPartType.gzip;
            compressedPart.Value = CommonUtilityHelper.CompressData(claimXmlDoc.OuterXml, _loggingService);

            R68CompressedPart[] compressedParts = new R68CompressedPart[1];
            compressedParts[0] = compressedPart;

            R68.Items = compressedParts;
        }