Exemplo n.º 1
0
        /// <summary>
        /// Creates request module
        /// </summary>
        /// <param name="moduleFolder">Folder path reference to create Request module</param>
        /// <param name="name">Name of Request module</param>
        /// <param name="wseModuleParser">Contains transport information used to fill in Request Module</param>
        /// <param name="correlationId">Uniquely identify the Request Module</param>
        /// <returns></returns>
        public static ApiModule CreateRequestModule(TCFolder moduleFolder,
                                                    string name,
                                                    IWseArtifactsParser wseModuleParser,
                                                    string correlationId)
        {
            //Module Properties
            ApiModule requestApiModule =
                SetModuleStandardProperties(moduleFolder,
                                            name,
                                            correlationId,
                                            ScanTag.GetRequestScanTag(wseModuleParser));

            //Request Properties
            requestApiModule.AddTechnicalIdParam("Direction", Direction.Out.ToString());
            requestApiModule.AddTechnicalIdParam("InactiveNodes", "Remove");
            requestApiModule.AddTechnicalIdParam("IsRequest", "True");
            requestApiModule.AddTechnicalIdParam("MessagesGenerated", "True");
            requestApiModule.AddConfigurationParam("Executor", "HttpSend");
            requestApiModule.AddTechnicalIdParam("Method", wseModuleParser.Method);
            requestApiModule.AddTechnicalIdParam("Endpoint", wseModuleParser.Endpoint);
            requestApiModule.AddTechnicalIdParam("Resource", wseModuleParser.Resource);
            requestApiModule.AddQueryParams(wseModuleParser.QueryParams);
            requestApiModule.AddPathParams(wseModuleParser.PathParams);
            requestApiModule.AddHeaders(wseModuleParser.Headers);
            if (!string.IsNullOrEmpty(wseModuleParser.RequestPayload))
            {
                requestApiModule.APISetMessagePayload(wseModuleParser.RequestPayload);
            }
            return(requestApiModule);
        }