public override Guid Execute(out ErrorResultTO errors, int update) { #pragma warning disable CC0021 Dev2Logger.Info($"Starting Remote Execution. Service Name:{DataObject.ServiceName} Resource Id:{DataObject.ResourceID} Mode:{(DataObject.IsDebug ? "Debug" : "Execute")}", GlobalConstants.WarewolfInfo); #pragma warning restore CC0021 var serviceName = DataObject.ServiceName; errors = new ErrorResultTO(); Dev2Logger.Debug("Creating DataList fragment for remote execute", GlobalConstants.WarewolfDebug); var dataListFragment = ExecutionEnvironmentUtils.GetXmlInputFromEnvironment(DataObject, DataObject.RemoteInvokeResultShape.ToString(), update); var result = string.Empty; var connection = GetConnection(DataObject.EnvironmentID); if (connection == null) { errors.AddError(ErrorResource.ServiceNotFound); return(DataObject.DataListID); } try { result = ExecutePostRequest(connection, serviceName, dataListFragment); var msg = DataObject.IsDebug ? FetchRemoteDebugItems(connection) : new List <IDebugState>(); DataObject.RemoteDebugItems = msg; // set them so they can be acted upon } catch (Exception e) { var errorMessage = e.Message.Contains("Forbidden") ? "Executing a service requires Execute permissions" : e.Message; DataObject.Environment.Errors.Add(errorMessage); Dev2Logger.Error(e, GlobalConstants.WarewolfError); } // Create tmpDL ExecutionEnvironmentUtils.UpdateEnvironmentFromOutputPayload(DataObject, result.ToStringBuilder(), DataObject.RemoteInvokeResultShape.ToString()); #pragma warning disable CC0021 Dev2Logger.Info($"Completed Remote Execution. Service Name:{DataObject.ServiceName} Resource Id:{DataObject.ResourceID} Mode:{(DataObject.IsDebug ? "Debug" : "Execute")}", GlobalConstants.WarewolfInfo); #pragma warning restore CC0021 return(Guid.Empty); }
public override Guid Execute(out ErrorResultTO errors, int update) { Dev2Logger.Log.Info(String.Format("Starting Remote Execution. Service Name:{0} Resource Id:{1} Mode:{2}", DataObject.ServiceName, DataObject.ResourceID, DataObject.IsDebug ? "Debug" : "Execute")); var serviceName = DataObject.ServiceName; errors = new ErrorResultTO(); // get data in a format we can send ;) Dev2Logger.Log.Debug("Creating DataList fragment for remote execute"); var dataListFragment = ExecutionEnvironmentUtils.GetXmlInputFromEnvironment(DataObject, DataObject.WorkspaceID, DataObject.RemoteInvokeResultShape.ToString(), update); string result = string.Empty; var connection = GetConnection(DataObject.EnvironmentID); if (connection == null) { errors.AddError("Server source not found."); return(DataObject.DataListID); } try { // Invoke Remote WF Here ;) result = ExecuteGetRequest(connection, serviceName, dataListFragment); IList <IDebugState> msg = FetchRemoteDebugItems(connection); DataObject.RemoteDebugItems = msg; // set them so they can be acted upon } catch (Exception e) { var errorMessage = e.Message.Contains("Forbidden") ? "Executing a service requires Execute permissions" : e.Message; DataObject.Environment.Errors.Add(errorMessage); Dev2Logger.Log.Error(e); } // Create tmpDL ExecutionEnvironmentUtils.UpdateEnvironmentFromOutputPayload(DataObject, result.ToStringBuilder(), DataObject.RemoteInvokeResultShape.ToString(), update); Dev2Logger.Log.Info(String.Format("Completed Remote Execution. Service Name:{0} Resource Id:{1} Mode:{2}", DataObject.ServiceName, DataObject.ResourceID, DataObject.IsDebug ? "Debug" : "Execute")); return(Guid.Empty); }