Beispiel #1
0
        /// <summary>
        /// Ejecuta un servicio de negocio.
        /// </summary>
        /// <param name="providerName">Nombre del proveedor de metadata de servicios.-</param>
        /// <param name="pRequest">Request con datos de entrada para la  ejecución del servicio.</param>
        /// <returns>XML con el resultado de la  ejecución del servicio.</returns>
        /// <date>2008-04-07T00:00:00</date>
        /// <author>moviedo</author>
        public IServiceContract ExecuteService(string providerName, IServiceContract pRequest)
        {
            IServiceContract wResult = null;

            if (string.IsNullOrEmpty(pRequest.ServiceName))
            {
                throw get_TechnicalException_error_serviceName_null();
            }
            Boolean wExecuteOndispatcher = true;

            IRequest             req = (IRequest)pRequest;
            ServiceConfiguration wServiceConfiguration = FacadeHelper.GetServiceConfiguration(providerName, pRequest.ServiceName);

            //establezco el nombre del proveedor de seguridad al request
            req.SecurityProviderName = FacadeHelper.GetProviderInfo(providerName).SecurityProviderName;


            req.ContextInformation.SetProviderName(providerName);
            //if (String.IsNullOrEmpty(req.ContextInformation.DefaultCulture))
            //    req.ContextInformation.DefaultCulture = FacadeHelper.GetProviderInfo(providerName).DefaultCulture;

            // Validación de disponibilidad del servicio.
            FacadeHelper.ValidateAvailability(wServiceConfiguration, out wResult);
            if (wResult != null)
            {
                if (wResult.Error != null)
                {
                    return(wResult);
                }
            }

            // Caching del servicio.
            if (req.CacheSettings != null && req.CacheSettings.CacheOnServerSide) //--------->>> Implement the cache factory
            {
                wResult = GetCaheDataById(req, wServiceConfiguration);
                if (wResult != null)
                {
                    wExecuteOndispatcher = false;
                }
            }
            // Realiza la ejecucion del servicio
            if (wExecuteOndispatcher)
            {
                //  ejecución del servicio.
                if (wServiceConfiguration.TransactionalBehaviour == Fwk.Transaction.TransactionalBehaviour.Suppres)
                {
                    wResult = FacadeHelper.RunNonTransactionalProcess(pRequest, wServiceConfiguration);
                }
                else
                {
                    wResult = FacadeHelper.RunTransactionalProcess(pRequest, wServiceConfiguration);
                }
            }

            return(wResult);
        }
Beispiel #2
0
        /// <summary>
        /// Ejecuta un servicio de negocio.
        /// </summary>
        /// <param name="providerName">Nombre del proveedor de metadata de servicios.-</param>
        /// <param name="pRequest">Request con datos de entrada para la  ejecución del servicio.</param>
        /// <returns>XML con el resultado de la  ejecución del servicio.</returns>
        /// <date>2008-04-07T00:00:00</date>
        /// <author>moviedo</author>
        public static IServiceContract ExecuteService(string providerName, IServiceContract pRequest)
        {
            IServiceContract wResult = null;

            if (string.IsNullOrEmpty(pRequest.ServiceName))
            {
                TechnicalException te = new TechnicalException("El despachador de servicio no pudo continuar debido\r\n a que el nombre del servicio no fue establecido");
                Fwk.Exceptions.ExceptionHelper.SetTechnicalException <SimpleFacade>(te);

                te.ErrorId = "7005";
                throw te;
            }
            Boolean wExecuteOndispatcher = true;

            IRequest             req = (IRequest)pRequest;
            ServiceConfiguration wServiceConfiguration = FacadeHelper.GetServiceConfiguration(providerName, pRequest.ServiceName);



            //establezco el nombre del proveedor de seguridad al request
            req.SecurityProviderName = FacadeHelper.GetProviderInfo(providerName).SecurityProviderName;


            req.ContextInformation.SetProviderName(providerName);


            // Validación de disponibilidad del servicio.
            FacadeHelper.ValidateAvailability(wServiceConfiguration, out wResult);
            if (wResult != null)
            {
                if (wResult.Error != null)
                {
                    return(wResult);
                }
            }

            // Caching del servicio.
            if (req.CacheSettings != null && req.CacheSettings.CacheOnServerSide) //--------->>> Implement the cache factory
            {
                wResult = GetCaheDataById(req, wServiceConfiguration);
                if (wResult != null)
                {
                    wExecuteOndispatcher = false;
                }
            }
            // Realiza la ejecucion del servicio
            if (wExecuteOndispatcher)
            {
                //  ejecución del servicio.
                if (wServiceConfiguration.TransactionalBehaviour == Fwk.Transaction.TransactionalBehaviour.Suppres)
                {
                    wResult = FacadeHelper.RunNonTransactionalProcess(pRequest, wServiceConfiguration);
                }
                else
                {
                    wResult = FacadeHelper.RunTransactionalProcess(pRequest, wServiceConfiguration);
                }
            }

            return(wResult);
        }