Example #1
0
        public void SaveRequest(bool RequestSave, string SaveDirectory)
        {
            string RequestFileContent = string.Empty;

            if (RequestSave)
            {
                if (mAct.GetType() == typeof(ActWebAPISoap))
                {
                    RequestFileContent = BodyString;
                    mAct.AddOrUpdateInputParamValueAndCalculatedValue(ActWebAPIRest.Fields.ContentType, "XML");
                }
                else if (mAct.GetType() == typeof(ActWebAPIRest))
                {
                    if (!string.IsNullOrEmpty(BodyString))
                    {
                        RequestFileContent = BodyString;
                    }
                    else if ((mAct.RequestKeyValues.Count() > 0) && (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == "XwwwFormUrlEncoded"))
                    {
                        HttpContent UrlEncoded = new FormUrlEncodedContent(ConstructURLEncoded((ActWebAPIRest)mAct));
                        RequestFileContent = UrlEncoded.ToString();
                    }
                    else if ((mAct.RequestKeyValues.Count() > 0) && (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == "FormData"))
                    {
                        MultipartFormDataContent FormDataContent = new MultipartFormDataContent();
                        for (int i = 0; i < mAct.RequestKeyValues.Count(); i++)
                        {
                            FormDataContent.Add(new StringContent(mAct.RequestKeyValues[i].ValueForDriver), mAct.RequestKeyValues[i].ItemName.ToString());
                        }
                        RequestFileContent = FormDataContent.ToString();
                    }
                    else
                    {
                        RequestFileContent = RequestMessage.ToString();
                    }
                }

                string FileFullPath = Webserviceplatforminfo.SaveToFile("Request", RequestFileContent, SaveDirectory, mAct);
                mAct.AddOrUpdateReturnParamActual("Saved Request File Name", Path.GetFileName(FileFullPath));
            }
        }
Example #2
0
        public bool RequestContstructor(ActWebAPIBase act, string ProxySettings, bool useProxyServerSettings)
        {
            mAct = act;

            //Client Init & TimeOut
            Client = InitilizeClient();

            //EndPointURL
            if (!SetEndPointURL())
            {
                return(false);
            }

            //NetworkCredentials
            if (!SetNetworkCredentials())
            {
                return(false);
            }

            //Certificates
            if (!SetCertificates())
            {
                return(false);
            }

            //SecurityType
            SetSecurityType();

            //Authorization
            if (!SetAuthorization())
            {
                return(false);
            }

            //ProxySettings
            SetProxySettings(ProxySettings, useProxyServerSettings);

            //Headers
            AddHeadersToClient();

            //SetAutoDecompression
            SetAutoDecompression();

            if (act.GetType() == typeof(ActWebAPISoap))
            {
                return(RequestConstracotSOAP((ActWebAPISoap)act));
            }
            else
            {
                return(RequestConstractorREST((ActWebAPIRest)act));
            }
        }
Example #3
0
        public ActWebAPIEditPage(ActWebAPIBase act)
        {
            mAct = act;
            if (act.GetType() == typeof(ActWebAPIRest))
            {
                mWebApiType = ApplicationAPIUtils.eWebApiType.REST;
            }
            else
            {
                mWebApiType = ApplicationAPIUtils.eWebApiType.SOAP;
            }

            InitializeComponent();
            BindUiControls();
            InitializeUIByActionType();
        }
        public ActWebAPIEditPage(ActWebAPIBase act)
        {
            // Todo: Use DI
            AuthService  = new OAuth2Service();
            gingerRunner = new GingerRunner();
            mAct         = act;
            if (act.GetType() == typeof(ActWebAPIRest))
            {
                mWebApiType = ApplicationAPIUtils.eWebApiType.REST;
            }
            else
            {
                mWebApiType = ApplicationAPIUtils.eWebApiType.SOAP;
            }

            InitializeComponent();
            BindUiControls();
            InitializeUIByActionType();
        }