public override void ProcessRequest(ICommunicationContext ctx)
        {
            var serviceName = ctx.GetServiceName();
            var instanceId  = ctx.GetInstanceID();
            var bookmark    = ctx.GetBookmark();

            ctx.GetDataListID();
            var workspaceId = ctx.GetWorkspaceID();
            var formData    = new WebRequestTO();

            var xml = new SubmittedData().GetPostData(ctx);

            if (!string.IsNullOrEmpty(xml))
            {
                formData.RawRequestPayload = xml;
            }

            formData.ServiceName   = serviceName;
            formData.InstanceID    = instanceId;
            formData.Bookmark      = bookmark;
            formData.WebServerUrl  = ctx.Request.Uri.ToString();
            formData.Dev2WebServer = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}";

            if (ExecutingUser == null)
            {
                throw new Exception(ErrorResource.NullExecutingUser);
            }

            try
            {
                // Execute in its own thread to give proper context
                var t = new Thread(() =>
                {
                    Thread.CurrentPrincipal = ExecutingUser;

                    var responseWriter = CreateForm(formData, serviceName, workspaceId, ctx.FetchHeaders(), ctx.Request.User);
                    ctx.Send(responseWriter);
                });

                t.Start();
                t.Join();
            }
            catch (Exception e)
            {
                Dev2Logger.Error(this, e, GlobalConstants.WarewolfError);
            }
        }
예제 #2
0
        public override void ProcessRequest(ICommunicationContext ctx)
        {
            var postDataListId = ctx.GetDataListID();

            if (postDataListId != null)
            {
                new WebPostRequestHandler(_resourceCatalog, _testCatalog, _testCoverageCatalog, _esbChannelFactory).ProcessRequest(ctx);
                return;
            }

            var serviceName = ctx.GetServiceName();
            var workspaceId = ctx.GetWorkspaceID();

            var requestTo = new WebRequestTO
            {
                ServiceName          = serviceName,
                WebServerUrl         = ctx.Request.Uri.ToString(),
                Dev2WebServer        = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}",
                IsUrlWithTokenPrefix = ctx.Request.IsTokenAuthentication
            };
            var data = new SubmittedData().GetPostData(ctx);

            if (!string.IsNullOrEmpty(data))
            {
                requestTo.RawRequestPayload = data;
            }
            var variables = ctx.Request.BoundVariables;

            if (variables != null)
            {
                foreach (string key in variables)
                {
                    requestTo.Variables.Add(key, variables[key]);
                }
            }
            // Execute in its own thread to give proper context ;)
            Thread.CurrentPrincipal = ctx.Request.User;

            var responseWriter = CreateForm(requestTo, serviceName, workspaceId, ctx.FetchHeaders(), ctx.Request.User);

            ctx.Send(responseWriter);
        }
예제 #3
0
        public override void ProcessRequest(ICommunicationContext ctx)
        {
            var postDataListID = ctx.GetDataListID();

            if (postDataListID != null)
            {
                _catalog     = _catalog ?? ResourceCatalog.Instance;
                _testCatalog = _testCatalog ?? TestCatalog.Instance;
                new WebPostRequestHandler(_catalog, _testCatalog).ProcessRequest(ctx);
                return;
            }

            var serviceName = ctx.GetServiceName();
            var workspaceID = ctx.GetWorkspaceID();

            var requestTO = new WebRequestTO {
                ServiceName = serviceName, WebServerUrl = ctx.Request.Uri.ToString(), Dev2WebServer = $"{ctx.Request.Uri.Scheme}://{ctx.Request.Uri.Authority}"
            };
            var data = SubmittedData.GetPostData(ctx);

            if (!string.IsNullOrEmpty(data))
            {
                requestTO.RawRequestPayload = data;
            }
            var variables = ctx.Request.BoundVariables;

            if (variables != null)
            {
                foreach (string key in variables)
                {
                    requestTO.Variables.Add(key, variables[key]);
                }
            }
            // Execute in its own thread to give proper context ;)
            Thread.CurrentPrincipal = ctx.Request.User;

            var responseWriter = CreateForm(requestTO, serviceName, workspaceID, ctx.FetchHeaders(), ctx.Request.User);

            ctx.Send(responseWriter);
        }
예제 #4
0
 protected static string GetDataListID(ICommunicationContext ctx) => ctx.GetDataListID();
 protected static string GetDataListID(ICommunicationContext ctx)
 {
     return(ctx.GetDataListID());
 }