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)); } }
public void SaveResponseToFile(bool saveResponse, string savePath) { if (saveResponse) { string ResponseFileContent = string.Empty; if (mAct.GetType() == typeof(ActWebAPISoap)) { ResponseFileContent = ResponseMessage; mAct.AddOrUpdateInputParamValueAndCalculatedValue(ActWebAPIRest.Fields.ResponseContentType, "XML"); } else if (mAct.GetType() == typeof(ActWebAPIRest)) { if (!string.IsNullOrEmpty(ResponseMessage)) { ResponseFileContent = ResponseMessage; } else { if (Response != null && Response.Headers != null) { ResponseFileContent = Response.Headers.ToString(); } else { ResponseFileContent = string.Empty; } } } ResponseFileContent = Amdocs.Ginger.Common.XMLDocExtended.PrettyXml(ResponseFileContent); string FileFullPath = Webserviceplatforminfo.SaveToFile("Response", ResponseFileContent, savePath, mAct); mAct.AddOrUpdateReturnParamActual("Saved Response File Name", Path.GetFileName(FileFullPath)); } }
// Use for action which run on Agent - session public static void ExecutePlugInActionOnAgent(Agent agent, IActPluginExecution actPlugin) { NewPayLoad payload = GeneratePlatformActionPayload(actPlugin, agent); // Temp design !!!!!!!!!!!!!!!!!! ((Act)actPlugin).AddNewReturnParams = true; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ??? // Send the payload to the service NewPayLoad RC = agent.GingerNodeProxy.RunAction(payload); ParseActionResult(RC, (Act)actPlugin); if (actPlugin is IActPluginPostRun ActPluginPostRun) { ActPluginPostRun.ParseOutput(); } #warning get the follinging from platform in fo /* IPlatformInfo Platforminfo = null; * * if(Platforminfo is IPlatformPluginPostRun PluginPostrun) * { * PluginPostrun.PostExecute(agent, (Act)actPlugin); * } */ if (agent.Platform == GingerCoreNET.SolutionRepositoryLib.RepositoryObjectsLib.PlatformsLib.ePlatformType.WebServices) { Webserviceplatforminfo Platfrominfo = new Webserviceplatforminfo(); Platfrominfo.PostExecute(agent, (Act)actPlugin); } }