/// <summary>
        /// Sends the specified <paramref name="references"/> to the Web Service defined by <see cref="_config"/>
        /// </summary>
        /// <param name="references">The <see cref="IStructureReference"/></param>
        /// <param name="resolveReferences">
        /// The resolve references
        /// </param>
        /// <returns>The QueryStructureResponse returned by the Web Service</returns>
        public ISdmxObjects SendQueryStructureRequest(IEnumerable <IStructureReference> references, bool resolveReferences)
        {
            var queryStructureRequestBuilderManager = new QueryStructureRequestBuilderManager();

            IStructureQueryFormat <XDocument> queryFormat = new QueryStructureRequestFormat();
            var wdoc = queryStructureRequestBuilderManager.BuildStructureQuery(references, queryFormat, resolveReferences);

            var doc = new XmlDocument();

            doc.LoadXml(wdoc.ToString());

            string tempFileName = Path.GetTempFileName();

            try
            {
                this.SendRequest(doc, SDMXWSFunction.QueryStructure, 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);
            }
        }
        public void TestBuildStructureQuery(string testFile)
        {
            var manager = new CustomQueryParseManager(SdmxSchemaEnumType.VersionTwo);

            IQueryWorkspace result;
            using (var readable = new FileReadableDataLocation(testFile))
            {
                result = manager.ParseQueries(readable);
            }

            var builderManager = new QueryStructureRequestBuilderManager(new HeaderImpl("TEST", "TEST"));
            var document = builderManager.BuildStructureQuery(result.SimpleStructureQueries, new QueryStructureRequestFormat(), result.ResolveReferences); 
            Assert.NotNull(document);
        }
예제 #3
0
        /// <summary>
        /// Sends the specified <paramref name="references"/> to the Web Service defined by <see cref="_config"/> 
        /// </summary>
        /// <param name="references">The <see cref="IStructureReference"/></param>
        /// <param name="resolveReferences">
        /// The resolve references
        /// </param>
        /// <returns>The QueryStructureResponse returned by the Web Service</returns>
        public ISdmxObjects SendQueryStructureRequest(IEnumerable<IStructureReference> references, bool resolveReferences)
        {
            var queryStructureRequestBuilderManager= new QueryStructureRequestBuilderManager();

            IStructureQueryFormat<XDocument> queryFormat = new QueryStructureRequestFormat();
            var wdoc = queryStructureRequestBuilderManager.BuildStructureQuery(references, queryFormat, resolveReferences);

            var doc = new XmlDocument();
            doc.LoadXml(wdoc.ToString());

            string tempFileName = Path.GetTempFileName();

            try
            {

                this.SendRequest(doc, SDMXWSFunction.QueryStructure, 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);
            }
        }