Пример #1
0
        /// <summary>
        /// Sends the specified <paramref name="complexStructureQuery"/> to the Web Service defined by <see cref="_config"/>
        /// </summary>
        /// <param name="complexStructureQuery">The <see cref="IComplexStructureQuery"/></param>
        /// <returns>The ISdmxObjects returned by the Web Service</returns>
        private ISdmxObjects SendQueryStructureRequest(IComplexStructureQuery complexStructureQuery, SDMXWSFunctionV21 sdmxwsFunctionV21)
        {
            IStructureQueryFormat <XDocument> queryFormat = new ComplexQueryFormatV21();

            IComplexStructureQueryFactory <XDocument>        factory = new ComplexStructureQueryFactoryV21 <XDocument>();
            IComplexStructureQueryBuilderManager <XDocument> complexStructureQueryBuilderManager = new ComplexStructureQueryBuilderManager <XDocument>(factory);
            var wdoc = complexStructureQueryBuilderManager.BuildComplexStructureQuery(complexStructureQuery, queryFormat);
            var doc  = new XmlDocument();

            doc.LoadXml(wdoc.ToString());

            string tempFileName = Path.GetTempFileName();

            try
            {
                this.SendRequest(doc, sdmxwsFunctionV21, tempFileName);

                ISdmxObjects             structureObjects = new SdmxObjectsImpl();
                IStructureParsingManager parsingManager   = new StructureParsingManager(SdmxSchemaEnumType.Null);
                using (var dataLocation = new FileReadableDataLocation(tempFileName))
                {
                    IStructureWorkspace structureWorkspace = parsingManager.ParseStructures(dataLocation);
                    structureObjects = structureWorkspace.GetStructureObjects(false);
                }

                NsiClientValidation.CheckResponse(structureObjects);
                return(structureObjects);
            }
            finally
            {
                //Delete the temporary file
                File.Delete(tempFileName);
            }
        }
Пример #2
0
        /// <summary>
        /// Sends the specified <paramref name="complexStructureQuery"/> to the Web Service defined by <see cref="_config"/> 
        /// </summary>
        /// <param name="complexStructureQuery">The <see cref="IComplexStructureQuery"/></param>
        /// <returns>The ISdmxObjects returned by the Web Service</returns>
        private ISdmxObjects SendQueryStructureRequest(IComplexStructureQuery complexStructureQuery, SDMXWSFunctionV21 sdmxwsFunctionV21)
        {
            IStructureQueryFormat<XDocument> queryFormat = new ComplexQueryFormatV21();

            IComplexStructureQueryFactory<XDocument> factory = new ComplexStructureQueryFactoryV21<XDocument>();
            IComplexStructureQueryBuilderManager<XDocument> complexStructureQueryBuilderManager = new ComplexStructureQueryBuilderManager<XDocument>(factory);
            var wdoc = complexStructureQueryBuilderManager.BuildComplexStructureQuery(complexStructureQuery, queryFormat);
            var doc = new XmlDocument();
            doc.LoadXml(wdoc.ToString());

            string tempFileName = Path.GetTempFileName();

            try
            {
                this.SendRequest(doc, sdmxwsFunctionV21, tempFileName);

                ISdmxObjects structureObjects = new SdmxObjectsImpl();
                IStructureParsingManager parsingManager = new StructureParsingManager(SdmxSchemaEnumType.Null);
                using (var dataLocation = new FileReadableDataLocation(tempFileName))
                {
                    IStructureWorkspace structureWorkspace = parsingManager.ParseStructures(dataLocation);
                    structureObjects = structureWorkspace.GetStructureObjects(false);
                }

                NsiClientValidation.CheckResponse(structureObjects);
                return structureObjects;
            }
            finally
            {
                //Delete the temporary file
                File.Delete(tempFileName);
            }
        }