コード例 #1
0
        private ActWebAPISoap CreateActWebAPISOAP(ApplicationAPIModel AAMB, ActWebAPIModel ActWebAPIModel)
        {
            ActWebAPISoap actWebAPISoap = new ActWebAPISoap();

            FillAPIBaseFields(AAMB, actWebAPISoap, ActWebAPIModel);
            return(actWebAPISoap);
        }
コード例 #2
0
        private static void GetActivityWithActWebApiActions()
        {
            Activity activity = new Activity();

            activity.Active = true;
            activity.SelectedForConversion = true;
            activity.TargetApplication     = webService;
            ActWebAPIRest actRest = new ActWebAPIRest();

            actRest.Active      = true;
            actRest.Description = "WebAPI REST Action-XMLBody";

            SetRestActionInputValues(actRest, nameof(ActWebAPIBase.Fields.RequestBody), GetXMLBody());
            SetRestActionInputValues(actRest, nameof(ActWebAPIBase.Fields.EndPointURL), "https://jsonplaceholder.typicode.com/posts/1");

            activity.Acts.Add(actRest);

            ActWebAPISoap actSoapJson = new ActWebAPISoap();

            actSoapJson.Active      = true;
            actSoapJson.Description = "WebAPI Soap Action-JsonBody";

            SetRestActionInputValues(actSoapJson, nameof(ActWebAPIBase.Fields.RequestBody), GetJsonBody());
            SetRestActionInputValues(actSoapJson, nameof(ActWebAPIBase.Fields.EndPointURL), "http://ws.cdyne.com/delayedstockquote/delayedstockquote.asmx");

            activity.Acts.Add(actSoapJson);

            mBF.AddActivity(activity);
            mListBF.Add(mBF);
        }
コード例 #3
0
        public void ResetActionList()
        {
            a1.Acts.Clear();

            ActWebAPISoap actWebAPISoap = new ActWebAPISoap();

            actWebAPISoap.ItemName = "Action1";
            actWebAPISoap.ActInputValues.Add(new Amdocs.Ginger.Repository.ActInputValue()
            {
                Param = ActWebAPIBase.Fields.EndPointURL, Value = "bla bli bla VTFInsideList bla bla bla"
            });
            actWebAPISoap.ActReturnValues.Add(new Amdocs.Ginger.Repository.ActReturnValue()
            {
                Param = "ReturnValue1", Expected = "I expect you to VTFInsideList behave"
            });
            actWebAPISoap.Active = true;
            a1.Acts.Add(actWebAPISoap);

            ActClearAllVariables actClearAllVariables = new ActClearAllVariables();

            actClearAllVariables.ItemName     = "Action2";
            actClearAllVariables.VariableName = "My Variable is VTFStringField";
            a1.Acts.Add(actClearAllVariables);

            ActScript actScript = new ActScript();

            actScript.ItemName      = "Action3";
            actScript.ScriptCommand = ActScript.eScriptAct.FreeCommand;
            actScript.Wait          = 13132424;
            a1.Acts.Add(actScript);

            mApplicationAPIModels.Clear();

            ApplicationAPIModel applicationAPIModel = new ApplicationAPIModel();

            applicationAPIModel.APIType     = ApplicationAPIUtils.eWebApiType.SOAP;
            applicationAPIModel.EndpointURL = "VTF";
            applicationAPIModel.DoNotFailActionOnBadRespose = true;
            applicationAPIModel.AppModelParameters.Add(new AppModelParameter()
            {
                PlaceHolder = "VTF", Path = "VTF/Path/Path/Path", OptionalValuesList = new ObservableList <OptionalValue>()
                {
                    new OptionalValue()
                    {
                        Value = "VTF1"
                    }, new OptionalValue()
                    {
                        Value = "VTF2"
                    }
                }
            });
            applicationAPIModel.HttpHeaders.Add(new APIModelKeyValue()
            {
                Param = "Content-Type", Value = "Applicaiton/VTF"
            });
            mApplicationAPIModels.Add(applicationAPIModel);
        }
コード例 #4
0
        public void WebServices_WebAPISOAP()
        {
            Activity Activity1 = new Activity();

            Activity1.Active       = true;
            Activity1.ActivityName = "Web API Soap";
            Activity1.CurrentAgent = wsAgent;
            mBF.Activities.Add(Activity1);

            ActWebAPISoap soapAct = new ActWebAPISoap();
            ActWebAPIBase act     = new ActWebAPIBase();

            //HttpWebClientUtils testClient = new HttpWebClientUtils();

            //Build SOAP Request:
            soapAct.AddOrUpdateInputParamValue(ActWebAPIBase.Fields.EndPointURL, "http://www.thomas-bayer.com/axis2/services/BLZService");
            soapAct.AddOrUpdateInputParamValue(ActWebAPIBase.Fields.CertificateTypeRadioButton, ApplicationAPIUtils.eCretificateType.AllSSL.ToString());
            soapAct.AddOrUpdateInputParamValue(ActWebAPISoap.Fields.SOAPAction, "UnitTest");
            soapAct.AddOrUpdateInputParamValue(ActWebAPIBase.Fields.SecurityType, ApplicationAPIUtils.eSercurityType.None.ToString());
            soapAct.AddOrUpdateInputParamValue(ActWebAPIBase.Fields.RequestBodyTypeRadioButton, ApplicationAPIUtils.eRequestBodyType.FreeText.ToString());
            //Set Request body content:
            soapAct.mUseRequestBody = true;
            soapAct.AddOrUpdateInputParamValue(ActWebAPIBase.Fields.RequestBody, getXML());
            soapAct.Active = true;
            soapAct.EnableRetryMechanism = false;
            soapAct.ItemName             = "Web API Soap";

            //BusinessFlow bzFlow = new BusinessFlow();
            //WebServicesDriver testDriver = new WebServicesDriver(bzFlow);
            //testDriver.RunAction(soapAct);
            //Act Act1 = new Act();


            mBF.Activities[0].Acts.Add(soapAct);

            mDriver.StartDriver();
            mGR.RunRunner();

            if (soapAct.ReturnValues.Count > 0)
            {
                foreach (ActReturnValue val in soapAct.ReturnValues)
                {
                    if (val.Actual.ToString() == "59586")
                    {
                        Assert.AreEqual(val.Actual, "59586");
                    }
                }
            }
        }
コード例 #5
0
ファイル: ActWebService.cs プロジェクト: lanicon/Ginger
        Act IObsoleteAction.GetNewAction()
        {
            AutoMapper.MapperConfiguration mapperConfiguration = new AutoMapper.MapperConfiguration(cfg => { cfg.CreateMap <Act, ActWebAPISoap>(); });
            ActWebAPISoap convertedActWebAPISoap = mapperConfiguration.CreateMapper().Map <Act, ActWebAPISoap>(this);

            convertedActWebAPISoap.AddOrUpdateInputParamValueAndCalculatedValue(ActWebAPIBase.Fields.EndPointURL, this.URL.Value);

            convertedActWebAPISoap.AddOrUpdateInputParamValueAndCalculatedValue(ActWebAPIBase.Fields.AuthorizationType, ApplicationAPIUtils.eAuthType.NoAuthentication.ToString());
            convertedActWebAPISoap.AddOrUpdateInputParamValueAndCalculatedValue(ActWebAPIBase.Fields.SecurityType, ApplicationAPIUtils.eSercurityType.None.ToString());
            convertedActWebAPISoap.AddOrUpdateInputParamValueAndCalculatedValue(ActWebAPIBase.Fields.CertificateTypeRadioButton, ApplicationAPIUtils.eCretificateType.AllSSL.ToString());

            if (!string.IsNullOrEmpty(this.URLDomain.Value) || (!string.IsNullOrEmpty(this.URLUser.Value) && !string.IsNullOrEmpty(this.URLPass.Value)))
            {
                convertedActWebAPISoap.AddOrUpdateInputParamValueAndCalculatedValue(ActWebAPIBase.Fields.NetworkCredentialsRadioButton, ApplicationAPIUtils.eNetworkCredentials.Custom.ToString());
                convertedActWebAPISoap.AddOrUpdateInputParamValueAndCalculatedValue(ActWebAPIBase.Fields.URLDomain, this.URLDomain.Value);
                convertedActWebAPISoap.AddOrUpdateInputParamValueAndCalculatedValue(ActWebAPIBase.Fields.URLUser, this.URLUser.Value);
                convertedActWebAPISoap.AddOrUpdateInputParamValueAndCalculatedValue(ActWebAPIBase.Fields.URLPass, this.URLPass.Value);
            }
            else
            {
                convertedActWebAPISoap.AddOrUpdateInputParamValueAndCalculatedValue(ActWebAPIBase.Fields.NetworkCredentialsRadioButton, ApplicationAPIUtils.eNetworkCredentials.Default.ToString());
            }


            if (!string.IsNullOrEmpty(this.XMLfileName.ToString()))
            {
                convertedActWebAPISoap.AddOrUpdateInputParamValueAndCalculatedValue(ActWebAPIBase.Fields.RequestBodyTypeRadioButton, ApplicationAPIUtils.eRequestBodyType.TemplateFile.ToString());
                convertedActWebAPISoap.AddOrUpdateInputParamValueAndCalculatedValue(ActWebAPIBase.Fields.TemplateFileNameFileBrowser, this.XMLfileName.Value);
            }

            if (convertedActWebAPISoap.ReturnValues != null && convertedActWebAPISoap.ReturnValues.Count != 0)
            {
                //Old web service action add response as --> FullReponseXML
                //And new adds it as Response:
                // so we update it when converting from old action to new
                ActReturnValue ARC = convertedActWebAPISoap.ReturnValues.Where(x => x.Param == "FullReponseXML").FirstOrDefault();
                if (ARC != null)
                {
                    ARC.Param = "Response:";
                    if (!string.IsNullOrEmpty(ARC.Expected))
                    {
                        ARC.Expected = XMLDocExtended.PrettyXml(ARC.Expected);
                    }
                }
            }
            convertedActWebAPISoap.DynamicElements = this.DynamicXMLElements;

            return(convertedActWebAPISoap);
        }
コード例 #6
0
        private bool RequestConstracotSOAP(ActWebAPISoap act)
        {
            //Set default parameters for SOAP Actions
            RequestMessage = new HttpRequestMessage(HttpMethod.Post, Client.BaseAddress);
            string SoapAction = mAct.GetInputParamCalculatedValue(ActWebAPISoap.Fields.SOAPAction);

            RequestMessage.Headers.Add("SOAPAction", SoapAction);

            //WorkArownd for configuring SOAP content type deferent then text/xml
            ActInputValue ContetnTypeHeader = mAct.HttpHeaders.Where(x => x.Param == "Content-Type").FirstOrDefault();

            if (ContetnTypeHeader != null)
            {
                ContentType = ContetnTypeHeader.ValueForDriver;
            }
            else
            {
                ContentType = "text/xml";
            }

            string RequestBodyType = mAct.GetInputParamCalculatedValue(ActWebAPIBase.Fields.RequestBodyTypeRadioButton);

            string RequestBodyWithDynamicParameters = string.Empty;

            if (RequestBodyType == ApplicationAPIUtils.eRequestBodyType.FreeText.ToString())
            {
                RequestBodyWithDynamicParameters = mAct.GetInputParamCalculatedValue(ActWebAPIBase.Fields.RequestBody).ToString();
                if (string.IsNullOrEmpty(RequestBodyWithDynamicParameters))
                {
                    act.Error  = "Request setup Failed because of missing/wrong input";
                    act.ExInfo = "Request Body is missing";
                    return(false);
                }
            }
            else if (RequestBodyType == ApplicationAPIUtils.eRequestBodyType.TemplateFile.ToString())
            {
                if (!string.IsNullOrEmpty(mAct.GetInputParamCalculatedValue(ActWebAPIBase.Fields.TemplateFileNameFileBrowser).ToString()))
                {
                    RequestBodyWithDynamicParameters = GetStringBodyFromFile();
                    if (string.IsNullOrEmpty(RequestBodyWithDynamicParameters))
                    {
                        act.Error  = "Request setup Failed because of missing/wrong input";
                        act.ExInfo = "Request body file content is empty";
                        return(false);
                    }
                }
                else
                {
                    act.Error  = "Request setup Failed because of missing/wrong input";
                    act.ExInfo = "Request body file path is missing";
                    return(false);
                }
            }

            BodyString = SetDynamicValues(RequestBodyWithDynamicParameters);

            Reporter.ToLog(eLogLevel.INFO, "RequestBody: " + BodyString, null, true, true);

            RequestMessage.Content = new StringContent(BodyString, Encoding.UTF8, ContentType);

            return(true);
        }
コード例 #7
0
ファイル: ActWebService.cs プロジェクト: lanicon/Ginger
        string IObsoleteAction.TargetActionTypeName()
        {
            ActWebAPISoap newActApiSoap = new ActWebAPISoap();

            return(newActApiSoap.ActionDescription);
        }