Exemple #1
0
 public MetadataLoader(string QueriesPath, WebServiceLayer.classes.service.Net.WebServiceLayer WSLayer)
 {
     _queryPath   = QueriesPath;
     _webLayer    = WSLayer;
     _sdmxObjects = new Org.Sdmxsource.Sdmx.Util.Objects.Container.SdmxObjectsImpl();
     SdmxException.SetMessageResolver(new MessageDecoder());
 }
Exemple #2
0
        /// <summary>
        /// The application_ start.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Application_Start(object sender, EventArgs e)
        {
            _log.Debug("Starting application");
            SdmxException.SetMessageResolver(new MessageDecoder());
            UriUtils.FixSystemUriDotBug();

            var wsdlRegistry = WsdlRegistry.Instance;
            var sdmxRestServiceHostFactory = new SdmxRestServiceHostFactory(typeof(IStaticWsdlService));

            var serviceRoute = new ServiceRoute("wsdl", sdmxRestServiceHostFactory, typeof(StaticWsdlService));

            RouteTable.Routes.Add(serviceRoute);
            wsdlRegistry.Add(
                new WsdlInfo {
                Name = "NSIEstatV20Service", OriginalPath = "sdmx_estat/NSI.wsdl"
            },
                new WsdlInfo {
                Name = "NSIStdV20Service", OriginalPath = "sdmx_org/NSI.wsdl"
            },
                new WsdlInfo {
                Name = "SdmxService", OriginalPath = "sdmxv21/SDMX-WS.wsdl"
            });

            RouteTable.Routes.Add(new ServiceRoute("NSIEstatV20Service", new SoapServiceHostFactory(typeof(INSIEstatV20Service), "sdmx_estat/NSI.wsdl"), typeof(NsiEstatV20Service)));
            RouteTable.Routes.Add(new ServiceRoute("NSIStdV20Service", new SoapServiceHostFactory(typeof(INSIStdV20Service), "sdmx_org/NSI.wsdl"), typeof(NsiStdV20Service)));
            RouteTable.Routes.Add(new ServiceRoute("SdmxService", new SoapServiceHostFactory(typeof(INSIStdV21Service), "sdmxv21/SDMX-WS.wsdl"), typeof(NSIStdV21Service)));
            RouteTable.Routes.Add(new ServiceRoute("rest/data", new SdmxRestServiceHostFactory(typeof(IDataResource)), typeof(DataResource)));
            RouteTable.Routes.Add(new ServiceRoute("rest", new SdmxRestServiceHostFactory(typeof(IStructureResource)), typeof(StructureResource)));
        }
Exemple #3
0
        /// <summary>
        /// First Parse Message arrived from external process for REST SDMX
        /// </summary>
        /// <param name="query">data parsed from Sdmx CommonAPI</param>
        public void ParseQueryMessageREST(IRestDataQuery query)
        {
            HaveError    = false;
            ErrorMessage = null;
            try
            {
                ISdmxParsingObject pc = new SdmxParsingObject(SdmxStructureEnumType.Any)
                {
                    AgencyId = query.FlowRef.AgencyId,
                    _version = query.FlowRef.Version,
                };
                pc.PreliminarCheck();
                RetrievalManagerObject = new RetrievalManager(DataFlowElementId, this.VersionTypeResp);

                //RetrievalManagerObject.
                WhereStatement = new DataWhereStatment(query);
            }
            catch (SdmxException sdmxerr)
            {
                HaveError    = true;
                ErrorMessage = sdmxerr;
            }
            catch (Exception err)
            {
                HaveError    = true;
                ErrorMessage = new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.ParsingQueryError, err);
            }
        }
Exemple #4
0
        /// <summary>
        /// Builds an object of type  <see cref="SoapException"/>
        /// </summary>
        /// <param name="buildFrom">
        /// An Object to build the output object from
        /// </param>
        /// <param name="uri">
        /// The URI.
        /// </param>
        /// <returns>
        /// Object of type <see cref="SoapException"/>
        /// </returns>
        /// <exception cref="T:Org.Sdmxsource.Sdmx.Api.Exception.SdmxException">
        /// - If anything goes wrong during the build process
        /// </exception>
        public SoapException Build(SdmxException buildFrom, string uri)
        {
            _log.ErrorFormat("SdmxError : {0}, code : {1}", buildFrom.SdmxErrorCode.ErrorString, buildFrom.SdmxErrorCode.ClientErrorCode);
            _log.Error(buildFrom.FullMessage, buildFrom);
            if (buildFrom.SdmxErrorCode.EnumType.IsClientError())
            {
                var errorMessage = string.Format("{0}: {1}", buildFrom.SdmxErrorCode.ErrorString, buildFrom.Message);
                return(SoapFaultFactory.CreateSoapException(uri, string.Empty, errorMessage, SdmxV20Errors.ErrorNumberClient, uri, true, Resources.ErrorClientMessage));
            }

            return(SoapFaultFactory.CreateSoapException(uri, string.Empty, Resources.ErrorInternalError, SdmxV20Errors.ErrorNumberServer, uri, false, buildFrom.SdmxErrorCode.ErrorString));
        }
Exemple #5
0
        /// <summary>
        /// Builds an object of type  <see cref="FaultException"/>
        /// </summary>
        /// <param name="buildFrom">
        /// An Object to build the output object from
        /// </param>
        /// <param name="uri">
        /// The URI.
        /// </param>
        /// <returns>
        /// Object of type <see cref="FaultException{String}"/>
        /// </returns>
        public FaultException <SdmxFault> BuildException(SdmxException buildFrom, string uri)
        {
            _log.ErrorFormat("SdmxError : {0}, code : {1}", buildFrom.SdmxErrorCode.ErrorString, buildFrom.SdmxErrorCode.ClientErrorCode);
            _log.Error(buildFrom.FullMessage, buildFrom);
            var sdmxFault = new SdmxFault(buildFrom.SdmxErrorCode.ErrorString, buildFrom.SdmxErrorCode.ClientErrorCode, uri);

            if (buildFrom.SdmxErrorCode.EnumType.IsClientError())
            {
                return(CreateExceptionClient(sdmxFault));
            }

            return(CreateExceptionServer(sdmxFault));
        }
Exemple #6
0
 /// <summary>
 /// First Parse Message arrived from external process for SDMX 2.0
 /// </summary>
 /// <param name="manager">data parsed from DataQueryParseManager (Sdmx CommonAPI)</param>
 /// <param name="location">Arrived Message converted to IReadableDataLocation</param>
 public void ParseQueryMessage20(IDataQueryParseManager manager, IReadableDataLocation location)
 {
     HaveError    = false;
     ErrorMessage = null;
     try
     {
         RetrievalManagerObject = new RetrievalManager(DataFlowElementId, SdmxSchemaEnumType.VersionTwo);
         //RetrievalManagerObject.
         IList <IDataQuery> WhereStatement20 = manager.BuildDataQuery(location, (ISdmxObjectRetrievalManager)RetrievalManagerObject);
         WhereStatement = new DataWhereStatment(WhereStatement20);
     }
     catch (SdmxException sdmxerr)
     {
         HaveError    = true;
         ErrorMessage = sdmxerr;
     }
     catch (Exception err)
     {
         HaveError    = true;
         ErrorMessage = new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.ParsingQueryError, err);
     }
 }
Exemple #7
0
        /// <summary>
        /// Entrypoint of class FlyEngine that processes the request
        /// and produces a response or an error
        /// </summary>
        /// <param name="_parsingObject">Processed request</param>
        /// <param name="_versionType">Sdmx Version</param>
        public void Engine(ISdmxParsingObject _parsingObject, SdmxSchemaEnumType _versionType)
        {
            try
            {
                this.VersionTypeResp = _versionType;

                //IDBAccess DbAccess = new DWHAccess(FlyConfiguration.ConnectionString);


                _parsingObject.PreliminarCheck();
                FlyLog.WriteLog(this, FlyLog.LogTypeEnum.All, "Query Preliminar Check passed. Start creation of SDMXObject");

                Builder = CreateBuilder(_parsingObject, _versionType);

                if (Builder == null)
                {
                    throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.NotSupportedRegistryType, new Exception(_parsingObject.SdmxStructureType.ToString()));
                }
                FlyLog.WriteLog(this, FlyLog.LogTypeEnum.All, "Parsing Metadata: {0}", _parsingObject.SdmxStructureType.ToString());

                Builder.Build();

                ParseOtherRegistry(_parsingObject);

                Builder.AddReferences();
            }
            catch (SdmxException sdmxerr)
            {
                HaveError    = true;
                ErrorMessage = sdmxerr;
            }
            catch (Exception err)
            {
                HaveError    = true;
                ErrorMessage = new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.InternalError, err);
            }
        }
Exemple #8
0
 /// <summary>
 /// Builds an object of type  <see cref="WebFaultException{String}"/>
 /// </summary>
 /// <param name="buildFrom">
 /// An Object to build the output object from
 /// </param>
 /// <returns>
 /// Object of type <see cref="WebFaultException{String}"/>
 /// </returns>
 public WebFaultException <string> Build(SdmxException buildFrom)
 {
     _log.ErrorFormat("SdmxError : {0}, code : {1}", buildFrom.SdmxErrorCode.ErrorString, buildFrom.SdmxErrorCode.ClientErrorCode);
     _log.Error(buildFrom.FullMessage, buildFrom);
     return(new WebFaultException <string>(buildFrom.Message, (HttpStatusCode)buildFrom.HttpRestErrorCode));
 }