protected void ExecuteService(int update, out ErrorResultTO errors, IWcfAction method, IDSFDataObject dataObject, IOutputFormatter formater)
        {
            errors = new ErrorResultTO();
            Source = ResourceCatalog.GetResource <WcfSource>(dataObject.WorkspaceID, SourceId);
            var itrs = new List <IWarewolfIterator>(5);
            IWarewolfListIterator itrCollection = new WarewolfListIterator();
            var methodParameters = Inputs.Select(a => new MethodParameter {
                EmptyToNull = a.EmptyIsNull, IsRequired = a.RequiredField, Name = a.Name, Value = a.Value, TypeName = a.TypeName
            }).ToList();

            BuildParameterIterators(update, methodParameters.ToList(), itrCollection, itrs, dataObject);
            try
            {
                while (itrCollection.HasMoreData())
                {
                    var pos = 0;
                    foreach (var itr in itrs)
                    {
                        var injectVal = itrCollection.FetchNextValue(itr);
                        var param     = methodParameters.ToList()[pos];


                        param.Value = param.EmptyToNull &&
                                      (injectVal == null ||
                                       string.Compare(injectVal, string.Empty,
                                                      StringComparison.InvariantCultureIgnoreCase) == 0)
                            ? null
                            : injectVal;

                        pos++;
                    }

                    var result = Source.ExecuteMethod(method);

                    if (result != null)
                    {
                        ResponseManager = new ResponseManager {
                            OutputDescription = OutputDescription, Outputs = Outputs, IsObject = IsObject, ObjectName = ObjectName
                        };
                        ResponseManager.PushResponseIntoEnvironment(result.ToString(), update, dataObject);
                    }
                }
            }
            catch (Exception e)
            {
                errors.AddError(e.Message);
            }
        }
Esempio n. 2
0
        public object ExcecuteMethod(IWcfAction action, string endpointUrl)
        {
            var factory = new DynamicProxyFactory(endpointUrl);

            var contract = factory.Contracts.FirstOrDefault();

            if (contract == null)
            {
                throw new DynamicProxyException(ErrorResource.NoContractFound);
            }

            var proxy = factory.CreateProxy(contract.Name);

            var parameters = action.Inputs?.Select(
                a =>
                new MethodParameter
            {
                EmptyToNull = a.EmptyIsNull,
                IsRequired  = a.RequiredField,
                Name        = a.Name,
                Value       = a.Value,
                TypeName    = a.TypeName
            }).ToList() ?? new List <MethodParameter>();
            var paramObjects =
                parameters.Select(methodParameter => Convert.ChangeType(methodParameter.Value, Type.GetType(methodParameter.TypeName))).ToArray();

            var result = proxy.CallMethod(action.Method, paramObjects);

            var method = GetMethod(action.Method, proxy);

            if (result != null)
            {
                result = AdjustPluginResult(result, method);
            }

            return(result);
        }
 protected void ExecuteService(int update, out ErrorResultTO errors, IWcfAction method, IDSFDataObject dataObject) => ExecuteService(update, out errors, method, dataObject, null);
Esempio n. 4
0
 public object ExecuteMethod(IWcfAction action) => ProxyService.ExcecuteMethod(action, EndpointUrl);
Esempio n. 5
0
 public object ExcecuteMethod(IWcfAction action, string endpointUrl)
 {
     return(new object());
 }
Esempio n. 6
0
 public object ExecuteMethod(IWcfAction action)
 {
     return(ProxyService.ExcecuteMethod(action, EndpointUrl));
 }