コード例 #1
0
 internal void GetParameterPropertyDescriptors(IDictionary properties)
 {
     if (this.Site != null)
     {
         ITypeProvider service = (ITypeProvider)this.Site.GetService(typeof(ITypeProvider));
         if (service == null)
         {
             throw new InvalidOperationException(SR.GetString("General_MissingService", new object[] { typeof(ITypeProvider).FullName }));
         }
         Type interfaceType = null;
         if (this.InterfaceType != null)
         {
             interfaceType = service.GetType(this.InterfaceType.AssemblyQualifiedName);
         }
         if ((interfaceType != null) && interfaceType.IsInterface)
         {
             MethodInfo interfaceMethod = System.Workflow.Activities.Common.Helpers.GetInterfaceMethod(interfaceType, this.MethodName);
             if ((interfaceMethod != null) && (WebServiceActivityHelpers.ValidateParameterTypes(interfaceMethod).Count == 0))
             {
                 List <ParameterInfo> list;
                 List <ParameterInfo> list2;
                 WebServiceActivityHelpers.GetParameterInfo(interfaceMethod, out list, out list2);
                 foreach (ParameterInfo info2 in list)
                 {
                     PropertyDescriptor descriptor = new System.Workflow.Activities.Common.ParameterInfoBasedPropertyDescriptor(typeof(WebServiceInputActivity), info2, true, new Attribute[] { DesignOnlyAttribute.Yes });
                     properties[descriptor.Name] = descriptor;
                 }
             }
         }
     }
 }
コード例 #2
0
        private static IEnumerable GetContainedActivities(CompositeActivity activity)
        {
            if (!activity.Enabled)
            {
                yield break;
            }

            foreach (Activity containedActivity in activity.Activities)
            {
                if (containedActivity is CompositeActivity && !Helpers.IsCustomActivity((CompositeActivity)containedActivity))
                {
                    foreach (Activity nestedActivity in WebServiceActivityHelpers.GetContainedActivities((CompositeActivity)containedActivity))
                    {
                        if (nestedActivity.Enabled)
                        {
                            yield return(nestedActivity);
                        }
                    }
                }
                else
                {
                    if (containedActivity.Enabled)
                    {
                        yield return(containedActivity);
                    }
                }
            }
            yield break;
        }
コード例 #3
0
        internal void GetParameterPropertyDescriptors(IDictionary properties)
        {
            if (((IComponent)this).Site == null)
            {
                return;
            }

            ITypeProvider typeProvider = (ITypeProvider)((IComponent)this).Site.GetService(typeof(ITypeProvider));

            if (typeProvider == null)
            {
                throw new InvalidOperationException(SR.GetString(SR.General_MissingService, typeof(ITypeProvider).FullName));
            }

            if (this.InputActivityName != null && !String.IsNullOrEmpty(this.InputActivityName.Trim()))
            {
                WebServiceInputActivity webServiceReceive = Helpers.ParseActivity(Helpers.GetRootActivity(this), this.InputActivityName) as WebServiceInputActivity;
                if (webServiceReceive != null)
                {
                    Type type = null;
                    if (webServiceReceive.InterfaceType != null)
                    {
                        type = typeProvider.GetType(webServiceReceive.InterfaceType.AssemblyQualifiedName);
                    }

                    if (type != null)
                    {
                        MethodInfo method = Helpers.GetInterfaceMethod(type, webServiceReceive.MethodName);
                        if (method != null && WebServiceActivityHelpers.ValidateParameterTypes(method).Count == 0)
                        {
                            List <ParameterInfo> inputParameters, outParameters;
                            WebServiceActivityHelpers.GetParameterInfo(method, out inputParameters, out outParameters);

                            foreach (ParameterInfo paramInfo in outParameters)
                            {
                                PropertyDescriptor prop = null;
                                if (paramInfo.Position == -1)
                                {
                                    prop = new ParameterInfoBasedPropertyDescriptor(typeof(WebServiceOutputActivity), paramInfo, false, DesignOnlyAttribute.Yes);
                                }
                                else
                                {
                                    prop = new ParameterInfoBasedPropertyDescriptor(typeof(WebServiceOutputActivity), paramInfo, true, DesignOnlyAttribute.Yes);
                                }

                                if (prop != null)
                                {
                                    properties[prop.Name] = prop;
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #4
0
        internal static IEnumerable GetSucceedingActivities(Activity startActivity)
        {
            Activity         currentActivity = null;
            Stack <Activity> activityStack   = new Stack <Activity>();

            activityStack.Push(startActivity);

            while ((currentActivity = activityStack.Pop()) != null)
            {
                if (currentActivity is CompositeActivity && Helpers.IsCustomActivity((CompositeActivity)currentActivity))
                {
                    break;
                }

                if (currentActivity.Parent != null)
                {
                    bool pastCurrentActivity = false;

                    foreach (Activity siblingActivity in currentActivity.Parent.Activities)
                    {
                        if (siblingActivity == currentActivity)
                        {
                            pastCurrentActivity = true;
                            continue;
                        }

                        if (!pastCurrentActivity)
                        {
                            continue;
                        }

                        if (siblingActivity.Enabled)
                        {
                            if (siblingActivity is CompositeActivity && !Helpers.IsCustomActivity((CompositeActivity)siblingActivity))
                            {
                                foreach (Activity containedActivity in WebServiceActivityHelpers.GetContainedActivities((CompositeActivity)siblingActivity))
                                {
                                    yield return(containedActivity);
                                }
                            }
                            else
                            {
                                yield return(siblingActivity);
                            }
                        }
                    }
                }
                activityStack.Push(currentActivity.Parent);
            }
            yield break;
        }
コード例 #5
0
 internal void GetParameterPropertyDescriptors(IDictionary properties)
 {
     if (this.Site != null)
     {
         ITypeProvider service = (ITypeProvider)this.Site.GetService(typeof(ITypeProvider));
         if (service == null)
         {
             throw new InvalidOperationException(SR.GetString("General_MissingService", new object[] { typeof(ITypeProvider).FullName }));
         }
         if ((this.InputActivityName != null) && !string.IsNullOrEmpty(this.InputActivityName.Trim()))
         {
             WebServiceInputActivity activity = Helpers.ParseActivity(Helpers.GetRootActivity(this), this.InputActivityName) as WebServiceInputActivity;
             if (activity != null)
             {
                 Type interfaceType = null;
                 if (activity.InterfaceType != null)
                 {
                     interfaceType = service.GetType(activity.InterfaceType.AssemblyQualifiedName);
                 }
                 if (interfaceType != null)
                 {
                     MethodInfo interfaceMethod = Helpers.GetInterfaceMethod(interfaceType, activity.MethodName);
                     if ((interfaceMethod != null) && (WebServiceActivityHelpers.ValidateParameterTypes(interfaceMethod).Count == 0))
                     {
                         List <ParameterInfo> list;
                         List <ParameterInfo> list2;
                         WebServiceActivityHelpers.GetParameterInfo(interfaceMethod, out list, out list2);
                         foreach (ParameterInfo info2 in list2)
                         {
                             PropertyDescriptor descriptor = null;
                             if (info2.Position == -1)
                             {
                                 descriptor = new ParameterInfoBasedPropertyDescriptor(typeof(WebServiceOutputActivity), info2, false, new Attribute[] { DesignOnlyAttribute.Yes });
                             }
                             else
                             {
                                 descriptor = new ParameterInfoBasedPropertyDescriptor(typeof(WebServiceOutputActivity), info2, true, new Attribute[] { DesignOnlyAttribute.Yes });
                             }
                             if (descriptor != null)
                             {
                                 properties[descriptor.Name] = descriptor;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #6
0
ファイル: WebServiceFault.cs プロジェクト: dox0/DotNet471RS3
        ICollection IPropertyValueProvider.GetPropertyValues(ITypeDescriptorContext context)
        {
            StringCollection names = new StringCollection();

            if (context.PropertyDescriptor.Name == "InputActivityName")
            {
                foreach (Activity activity in WebServiceActivityHelpers.GetPreceedingActivities(this))
                {
                    if (activity is WebServiceInputActivity)
                    {
                        names.Add(activity.QualifiedName);
                    }
                }
            }
            return(names);
        }
コード例 #7
0
        protected override void OnActivityChanged(ActivityChangedEventArgs e)
        {
            base.OnActivityChanged(e);

            if (e.Member != null)
            {
                // If the interface name changed, clear out method name.
                if (e.Member.Name == "InterfaceType")
                {
                    if (this.Activity.Site != null)
                    {
                        Type interfaceType = e.NewValue as Type;
                        if (interfaceType != null)
                        {
                            new InterfaceTypeFilterProvider(Activity.Site).CanFilterType(interfaceType, true);
                        }

                        WebServiceInputActivity webServiceReceive  = e.Activity as WebServiceInputActivity;
                        PropertyDescriptor      propertyDescriptor = TypeDescriptor.GetProperties(Activity)["MethodName"];
                        if (propertyDescriptor != null)
                        {
                            propertyDescriptor.SetValue(Activity, String.Empty);
                        }
                    }
                }
                else if (e.Member.Name == "MethodName")
                {
                    // If method name changed, clear out parameters.
                    (e.Activity as WebServiceInputActivity).ParameterBindings.Clear();
                }

                // Refresh all other properties as well
                if (e.Member.Name == "InterfaceType" || e.Member.Name == "MethodName")
                {
                    TypeDescriptor.Refresh(e.Activity);
                }

                foreach (Activity succeedingActivity in WebServiceActivityHelpers.GetSucceedingActivities(this.Activity))
                {
                    if (succeedingActivity is WebServiceOutputActivity && ((WebServiceOutputActivity)(succeedingActivity)).InputActivityName == this.Activity.QualifiedName)
                    {
                        TypeDescriptor.Refresh(succeedingActivity);
                    }
                }
            }
        }
コード例 #8
0
 protected override void OnActivityChanged(ActivityChangedEventArgs e)
 {
     base.OnActivityChanged(e);
     if (e.Member != null)
     {
         if (e.Member.Name == "InterfaceType")
         {
             if (base.Activity.Site != null)
             {
                 Type newValue = e.NewValue as Type;
                 if (newValue != null)
                 {
                     new InterfaceTypeFilterProvider(base.Activity.Site).CanFilterType(newValue, true);
                 }
                 Activity           activity1  = e.Activity;
                 PropertyDescriptor descriptor = TypeDescriptor.GetProperties(base.Activity)["MethodName"];
                 if (descriptor != null)
                 {
                     descriptor.SetValue(base.Activity, string.Empty);
                 }
             }
         }
         else if (e.Member.Name == "MethodName")
         {
             (e.Activity as WebServiceInputActivity).ParameterBindings.Clear();
         }
         if ((e.Member.Name == "InterfaceType") || (e.Member.Name == "MethodName"))
         {
             TypeDescriptor.Refresh(e.Activity);
         }
         foreach (Activity activity in WebServiceActivityHelpers.GetSucceedingActivities(base.Activity))
         {
             if ((activity is WebServiceOutputActivity) && (((WebServiceOutputActivity)activity).InputActivityName == base.Activity.QualifiedName))
             {
                 TypeDescriptor.Refresh(activity);
             }
         }
     }
 }
コード例 #9
0
        internal void GetParameterPropertyDescriptors(IDictionary properties)
        {
            if (((IComponent)this).Site == null)
            {
                return;
            }

            ITypeProvider typeProvider = (ITypeProvider)((IComponent)this).Site.GetService(typeof(ITypeProvider));

            if (typeProvider == null)
            {
                throw new InvalidOperationException(SR.GetString(SR.General_MissingService, typeof(ITypeProvider).FullName));
            }

            Type type = null;

            if (this.InterfaceType != null)
            {
                type = typeProvider.GetType(this.InterfaceType.AssemblyQualifiedName);
            }

            if (type != null && type.IsInterface)
            {
                MethodInfo method = Helpers.GetInterfaceMethod(type, this.MethodName);
                if (method != null && WebServiceActivityHelpers.ValidateParameterTypes(method).Count == 0)
                {
                    List <ParameterInfo> inputParameters, outParameters;
                    WebServiceActivityHelpers.GetParameterInfo(method, out inputParameters, out outParameters);

                    foreach (ParameterInfo paramInfo in inputParameters)
                    {
                        PropertyDescriptor prop = new ParameterInfoBasedPropertyDescriptor(typeof(WebServiceInputActivity), paramInfo, true, DesignOnlyAttribute.Yes);
                        properties[prop.Name] = prop;
                    }
                }
            }
        }
コード例 #10
0
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection validationErrors = base.Validate(manager, obj);

            WebServiceInputActivity webServiceReceive = obj as WebServiceInputActivity;

            if (webServiceReceive == null)
            {
                throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(WebServiceInputActivity).FullName), "obj");
            }

            if (Helpers.IsActivityLocked(webServiceReceive))
            {
                return(validationErrors);
            }

            if (webServiceReceive.IsActivating)
            {
                if (WebServiceActivityHelpers.GetPreceedingActivities(webServiceReceive).GetEnumerator().MoveNext() == true)
                {
                    ValidationError error = new ValidationError(SR.GetString(SR.Error_ActivationActivityNotFirst), ErrorNumbers.Error_ActivationActivityNotFirst);
                    error.PropertyName = "IsActivating";
                    validationErrors.Add(error);
                    return(validationErrors);
                }

                if (WebServiceActivityHelpers.IsInsideLoop(webServiceReceive, null))
                {
                    ValidationError error = new ValidationError(SR.GetString(SR.Error_ActivationActivityInsideLoop), ErrorNumbers.Error_ActivationActivityInsideLoop);
                    error.PropertyName = "IsActivating";
                    validationErrors.Add(error);
                    return(validationErrors);
                }
            }
            else
            {
                if (WebServiceActivityHelpers.GetPreceedingActivities(webServiceReceive, true).GetEnumerator().MoveNext() == false)
                {
                    ValidationError error = new ValidationError(SR.GetString(SR.Error_WebServiceReceiveNotMarkedActivate), ErrorNumbers.Error_WebServiceReceiveNotMarkedActivate);
                    error.PropertyName = "IsActivating";
                    validationErrors.Add(error);
                    return(validationErrors);
                }
            }

            ITypeProvider typeProvider = (ITypeProvider)manager.GetService(typeof(ITypeProvider));

            if (typeProvider == null)
            {
                throw new InvalidOperationException(SR.GetString(SR.General_MissingService, typeof(ITypeProvider).FullName));
            }

            Type interfaceType = null;

            if (webServiceReceive.InterfaceType != null)
            {
                interfaceType = typeProvider.GetType(webServiceReceive.InterfaceType.AssemblyQualifiedName);
            }

            if (interfaceType == null)
            {
                ValidationError error = new ValidationError(SR.GetString(SR.Error_TypePropertyInvalid, "InterfaceType"), ErrorNumbers.Error_PropertyNotSet);
                error.PropertyName = "InterfaceType";
                validationErrors.Add(error);
            }
            else if (!interfaceType.IsInterface)
            {
                ValidationError error = new ValidationError(SR.GetString(SR.Error_InterfaceTypeNotInterface, "InterfaceType"), ErrorNumbers.Error_InterfaceTypeNotInterface);
                error.PropertyName = "InterfaceType";
                validationErrors.Add(error);
            }
            else
            {
                // Validate method
                if (String.IsNullOrEmpty(webServiceReceive.MethodName))
                {
                    validationErrors.Add(ValidationError.GetNotSetValidationError("MethodName"));
                }
                else
                {
                    MethodInfo methodInfo = Helpers.GetInterfaceMethod(interfaceType, webServiceReceive.MethodName);

                    if (methodInfo == null)
                    {
                        ValidationError error = new ValidationError(SR.GetString(SR.Error_MethodNotExists, "MethodName", webServiceReceive.MethodName), ErrorNumbers.Error_MethodNotExists);
                        error.PropertyName = "MethodName";
                        validationErrors.Add(error);
                    }
                    else
                    {
                        ValidationErrorCollection parameterTypeErrors = WebServiceActivityHelpers.ValidateParameterTypes(methodInfo);
                        if (parameterTypeErrors.Count > 0)
                        {
                            foreach (ValidationError parameterTypeError in parameterTypeErrors)
                            {
                                parameterTypeError.PropertyName = "MethodName";
                            }
                            validationErrors.AddRange(parameterTypeErrors);
                        }
                        else
                        {
                            List <ParameterInfo> inputParameters, outParameters;
                            WebServiceActivityHelpers.GetParameterInfo(methodInfo, out inputParameters, out outParameters);

                            // Check to see if all input parameters have a valid binding.
                            foreach (ParameterInfo paramInfo in inputParameters)
                            {
                                string paramName             = paramInfo.Name;
                                string parameterPropertyName = ParameterInfoBasedPropertyDescriptor.GetParameterPropertyName(webServiceReceive.GetType(), paramName);

                                Type   paramType  = paramInfo.ParameterType.IsByRef ? paramInfo.ParameterType.GetElementType() : paramInfo.ParameterType;
                                object paramValue = null;
                                if (webServiceReceive.ParameterBindings.Contains(paramName))
                                {
                                    if (webServiceReceive.ParameterBindings[paramName].IsBindingSet(WorkflowParameterBinding.ValueProperty))
                                    {
                                        paramValue = webServiceReceive.ParameterBindings[paramName].GetBinding(WorkflowParameterBinding.ValueProperty);
                                    }
                                    else
                                    {
                                        paramValue = webServiceReceive.ParameterBindings[paramName].GetValue(WorkflowParameterBinding.ValueProperty);
                                    }
                                }

                                if (!paramType.IsPublic || !paramType.IsSerializable)
                                {
                                    ValidationError validationError = new ValidationError(SR.GetString(SR.Error_TypeNotPublicSerializable, paramName, paramType.FullName), ErrorNumbers.Error_TypeNotPublicSerializable);
                                    validationError.PropertyName = parameterPropertyName;
                                    validationErrors.Add(validationError);
                                }
                                else if (!webServiceReceive.ParameterBindings.Contains(paramName) || paramValue == null)
                                {
                                    ValidationError validationError = ValidationError.GetNotSetValidationError(paramName);
                                    validationError.PropertyName = parameterPropertyName;
                                    validationErrors.Add(validationError);
                                }
                                else
                                {
                                    AccessTypes access = AccessTypes.Read;
                                    if (paramInfo.ParameterType.IsByRef)
                                    {
                                        access |= AccessTypes.Write;
                                    }

                                    ValidationErrorCollection variableErrors = ValidationHelpers.ValidateProperty(manager, webServiceReceive, paramValue,
                                                                                                                  new PropertyValidationContext(webServiceReceive.ParameterBindings[paramName], null, paramName), new BindValidationContext(paramInfo.ParameterType.IsByRef ? paramInfo.ParameterType.GetElementType() : paramInfo.ParameterType, access));
                                    foreach (ValidationError validationError in variableErrors)
                                    {
                                        validationError.PropertyName = parameterPropertyName;
                                    }
                                    validationErrors.AddRange(variableErrors);
                                }
                            }

                            if (webServiceReceive.ParameterBindings.Count > inputParameters.Count)
                            {
                                validationErrors.Add(new ValidationError(SR.GetString(SR.Warning_AdditionalBindingsFound), ErrorNumbers.Warning_AdditionalBindingsFound, true));
                            }

                            bool foundMatchingResponse = false;
                            foreach (Activity succeedingActivity in WebServiceActivityHelpers.GetSucceedingActivities(webServiceReceive))
                            {
                                if ((succeedingActivity is WebServiceOutputActivity && ((WebServiceOutputActivity)succeedingActivity).InputActivityName == webServiceReceive.Name) ||
                                    (succeedingActivity is WebServiceFaultActivity && ((WebServiceFaultActivity)succeedingActivity).InputActivityName == webServiceReceive.Name))
                                {
                                    foundMatchingResponse = true;
                                    break;
                                }
                            }

                            // If the method has out parameters or is the method has a return value,
                            // check to see if there are any corresponding WebServiceResponse activities.
                            if ((outParameters.Count > 0 || methodInfo.ReturnType != typeof(void)) && !foundMatchingResponse)
                            {
                                validationErrors.Add(new ValidationError(SR.GetString(SR.Error_WebServiceResponseNotFound), ErrorNumbers.Error_WebServiceResponseNotFound));
                            }
                        }
                    }
                }
            }
            return(validationErrors);
        }
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection errors   = base.Validate(manager, obj);
            WebServiceOutputActivity  activity = obj as WebServiceOutputActivity;

            if (activity == null)
            {
                throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(WebServiceOutputActivity).FullName }), "obj");
            }
            if (!Helpers.IsActivityLocked(activity))
            {
                List <ParameterInfo>    list;
                List <ParameterInfo>    list2;
                WebServiceInputActivity activity2 = null;
                if (string.IsNullOrEmpty(activity.InputActivityName))
                {
                    errors.Add(ValidationError.GetNotSetValidationError("InputActivityName"));
                    return(errors);
                }
                ITypeProvider service = (ITypeProvider)manager.GetService(typeof(ITypeProvider));
                if (service == null)
                {
                    throw new InvalidOperationException(SR.GetString("General_MissingService", new object[] { typeof(ITypeProvider).FullName }));
                }
                bool flag = false;
                foreach (Activity activity3 in WebServiceActivityHelpers.GetPreceedingActivities(activity))
                {
                    if (((activity3 is WebServiceOutputActivity) && (string.Compare(((WebServiceOutputActivity)activity3).InputActivityName, activity.InputActivityName, StringComparison.Ordinal) == 0)) || ((activity3 is WebServiceFaultActivity) && (string.Compare(((WebServiceFaultActivity)activity3).InputActivityName, activity.InputActivityName, StringComparison.Ordinal) == 0)))
                    {
                        if (activity3 is WebServiceOutputActivity)
                        {
                            errors.Add(new ValidationError(SR.GetString("Error_DuplicateWebServiceResponseFound", new object[] { activity3.QualifiedName, activity.InputActivityName }), 0x56a));
                            return(errors);
                        }
                        errors.Add(new ValidationError(SR.GetString("Error_DuplicateWebServiceFaultFound", new object[] { activity3.QualifiedName, activity.InputActivityName }), 0x574));
                        return(errors);
                    }
                }
                foreach (Activity activity4 in WebServiceActivityHelpers.GetPreceedingActivities(activity))
                {
                    if (string.Compare(activity4.QualifiedName, activity.InputActivityName, StringComparison.Ordinal) == 0)
                    {
                        if (activity4 is WebServiceInputActivity)
                        {
                            activity2 = activity4 as WebServiceInputActivity;
                            flag      = true;
                            break;
                        }
                        flag = false;
                        errors.Add(new ValidationError(SR.GetString("Error_WebServiceReceiveNotValid", new object[] { activity.InputActivityName }), 0x564));
                        return(errors);
                    }
                }
                if (!flag)
                {
                    errors.Add(new ValidationError(SR.GetString("Error_WebServiceReceiveNotFound", new object[] { activity.InputActivityName }), 0x55e));
                    return(errors);
                }
                Type interfaceType = null;
                if (activity2.InterfaceType != null)
                {
                    interfaceType = service.GetType(activity2.InterfaceType.AssemblyQualifiedName);
                }
                if (interfaceType == null)
                {
                    errors.Add(new ValidationError(SR.GetString("Error_WebServiceReceiveNotConfigured", new object[] { activity2.Name }), 0x566));
                    return(errors);
                }
                if (string.IsNullOrEmpty(activity2.MethodName))
                {
                    errors.Add(new ValidationError(SR.GetString("Error_WebServiceReceiveNotConfigured", new object[] { activity2.Name }), 0x566));
                    return(errors);
                }
                MethodInfo interfaceMethod = Helpers.GetInterfaceMethod(interfaceType, activity2.MethodName);
                if (interfaceMethod == null)
                {
                    errors.Add(new ValidationError(SR.GetString("Error_WebServiceReceiveNotConfigured", new object[] { activity2.Name }), 0x566));
                    return(errors);
                }
                ValidationErrorCollection errors2 = WebServiceActivityHelpers.ValidateParameterTypes(interfaceMethod);
                if (errors2.Count > 0)
                {
                    foreach (ValidationError error in errors2)
                    {
                        error.PropertyName = "InputActivityName";
                    }
                    errors.AddRange(errors2);
                    return(errors);
                }
                WebServiceActivityHelpers.GetParameterInfo(interfaceMethod, out list, out list2);
                if (list2.Count == 0)
                {
                    errors.Add(new ValidationError(SR.GetString("Error_WebServiceResponseNotNeeded"), 0x565));
                    return(errors);
                }
                foreach (ParameterInfo info2 in list2)
                {
                    string name  = info2.Name;
                    Type   type2 = info2.ParameterType.IsByRef ? info2.ParameterType.GetElementType() : info2.ParameterType;
                    if (info2.Position == -1)
                    {
                        name = "(ReturnValue)";
                    }
                    object binding = null;
                    if (activity.ParameterBindings.Contains(name))
                    {
                        if (activity.ParameterBindings[name].IsBindingSet(WorkflowParameterBinding.ValueProperty))
                        {
                            binding = activity.ParameterBindings[name].GetBinding(WorkflowParameterBinding.ValueProperty);
                        }
                        else
                        {
                            binding = activity.ParameterBindings[name].GetValue(WorkflowParameterBinding.ValueProperty);
                        }
                    }
                    if (!type2.IsPublic || !type2.IsSerializable)
                    {
                        ValidationError item = new ValidationError(SR.GetString("Error_TypeNotPublicSerializable", new object[] { name, type2.FullName }), 0x567)
                        {
                            PropertyName = (string.Compare(name, "(ReturnValue)", StringComparison.Ordinal) == 0) ? name : ParameterInfoBasedPropertyDescriptor.GetParameterPropertyName(activity2.GetType(), name)
                        };
                        errors.Add(item);
                    }
                    else if (!activity.ParameterBindings.Contains(name) || (binding == null))
                    {
                        ValidationError notSetValidationError = ValidationError.GetNotSetValidationError(name);
                        notSetValidationError.PropertyName = (string.Compare(name, "(ReturnValue)", StringComparison.Ordinal) == 0) ? name : ParameterInfoBasedPropertyDescriptor.GetParameterPropertyName(activity2.GetType(), name);
                        errors.Add(notSetValidationError);
                    }
                    else
                    {
                        AccessTypes read = AccessTypes.Read;
                        if ((info2.IsOut || info2.IsRetval) || (info2.Position == -1))
                        {
                            read = AccessTypes.Write;
                        }
                        ValidationErrorCollection errors3 = System.Workflow.Activities.Common.ValidationHelpers.ValidateProperty(manager, activity, binding, new PropertyValidationContext(activity.ParameterBindings[name], null, name), new BindValidationContext(info2.ParameterType.IsByRef ? info2.ParameterType.GetElementType() : info2.ParameterType, read));
                        foreach (ValidationError error4 in errors3)
                        {
                            if (string.Compare(name, "(ReturnValue)", StringComparison.Ordinal) != 0)
                            {
                                error4.PropertyName = ParameterInfoBasedPropertyDescriptor.GetParameterPropertyName(activity2.GetType(), name);
                            }
                        }
                        errors.AddRange(errors3);
                    }
                }
                if (activity.ParameterBindings.Count > list2.Count)
                {
                    errors.Add(new ValidationError(SR.GetString("Warning_AdditionalBindingsFound"), 0x630, true));
                }
            }
            return(errors);
        }
コード例 #12
0
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection errors   = base.Validate(manager, obj);
            WebServiceFaultActivity   activity = obj as WebServiceFaultActivity;

            if (activity == null)
            {
                throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(WebServiceFaultActivity).FullName }), "obj");
            }
            if (!Helpers.IsActivityLocked(activity))
            {
                List <ParameterInfo>    list;
                List <ParameterInfo>    list2;
                WebServiceInputActivity activity2 = null;
                if (string.IsNullOrEmpty(activity.InputActivityName))
                {
                    errors.Add(ValidationError.GetNotSetValidationError("InputActivityName"));
                    return(errors);
                }
                ITypeProvider service = (ITypeProvider)manager.GetService(typeof(ITypeProvider));
                if (service == null)
                {
                    throw new InvalidOperationException(SR.GetString("General_MissingService", new object[] { typeof(ITypeProvider).FullName }));
                }
                bool flag = false;
                foreach (Activity activity3 in WebServiceActivityHelpers.GetPreceedingActivities(activity))
                {
                    if (((activity3 is WebServiceFaultActivity) && (string.Compare(((WebServiceFaultActivity)activity3).InputActivityName, activity.InputActivityName, StringComparison.Ordinal) == 0)) || ((activity3 is WebServiceOutputActivity) && (string.Compare(((WebServiceOutputActivity)activity3).InputActivityName, activity.InputActivityName, StringComparison.Ordinal) == 0)))
                    {
                        if (activity3 is WebServiceFaultActivity)
                        {
                            errors.Add(new ValidationError(SR.GetString("Error_DuplicateWebServiceFaultFound", new object[] { activity3.Name, activity.InputActivityName }), 0x574));
                            return(errors);
                        }
                        errors.Add(new ValidationError(SR.GetString("Error_DuplicateWebServiceResponseFound", new object[] { activity3.Name, activity.InputActivityName }), 0x56a));
                        return(errors);
                    }
                }
                foreach (Activity activity4 in WebServiceActivityHelpers.GetPreceedingActivities(activity))
                {
                    if (string.Compare(activity4.QualifiedName, activity.InputActivityName, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        if (activity4 is WebServiceInputActivity)
                        {
                            activity2 = activity4 as WebServiceInputActivity;
                            flag      = true;
                            break;
                        }
                        flag = false;
                        errors.Add(new ValidationError(SR.GetString("Error_WebServiceReceiveNotValid", new object[] { activity.InputActivityName }), 0x564));
                        return(errors);
                    }
                }
                if (!flag)
                {
                    errors.Add(new ValidationError(SR.GetString("Error_WebServiceReceiveNotFound", new object[] { activity.InputActivityName }), 0x55e));
                    return(errors);
                }
                Type interfaceType = null;
                if (activity2.InterfaceType != null)
                {
                    interfaceType = service.GetType(activity2.InterfaceType.AssemblyQualifiedName);
                }
                if (interfaceType == null)
                {
                    errors.Add(new ValidationError(SR.GetString("Error_WebServiceReceiveNotConfigured", new object[] { activity2.Name }), 0x566));
                    return(errors);
                }
                if (string.IsNullOrEmpty(activity2.MethodName))
                {
                    errors.Add(new ValidationError(SR.GetString("Error_WebServiceReceiveNotConfigured", new object[] { activity2.Name }), 0x566));
                    return(errors);
                }
                MethodInfo interfaceMethod = Helpers.GetInterfaceMethod(interfaceType, activity2.MethodName);
                if (interfaceMethod == null)
                {
                    errors.Add(new ValidationError(SR.GetString("Error_WebServiceReceiveNotConfigured", new object[] { activity2.Name }), 0x566));
                    return(errors);
                }
                WebServiceActivityHelpers.GetParameterInfo(interfaceMethod, out list, out list2);
                if (list2.Count == 0)
                {
                    errors.Add(new ValidationError(SR.GetString("Error_WebServiceFaultNotNeeded"), 0x57a));
                    return(errors);
                }
            }
            return(errors);
        }
コード例 #13
0
ファイル: WebServiceFault.cs プロジェクト: dox0/DotNet471RS3
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection validationErrors = base.Validate(manager, obj);

            WebServiceFaultActivity webServiceFault = obj as WebServiceFaultActivity;

            if (webServiceFault == null)
            {
                throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(WebServiceFaultActivity).FullName), "obj");
            }

            if (Helpers.IsActivityLocked(webServiceFault))
            {
                return(validationErrors);
            }

            WebServiceInputActivity webServiceReceive = null;

            if (String.IsNullOrEmpty(webServiceFault.InputActivityName))
            {
                validationErrors.Add(ValidationError.GetNotSetValidationError("InputActivityName"));
            }
            else
            {
                ITypeProvider typeProvider = (ITypeProvider)manager.GetService(typeof(ITypeProvider));

                if (typeProvider == null)
                {
                    throw new InvalidOperationException(SR.GetString(SR.General_MissingService, typeof(ITypeProvider).FullName));
                }

                bool foundMatchingReceive = false;
                foreach (Activity activity in WebServiceActivityHelpers.GetPreceedingActivities(webServiceFault))
                {
                    if ((activity is WebServiceFaultActivity && String.Compare(((WebServiceFaultActivity)activity).InputActivityName, webServiceFault.InputActivityName, StringComparison.Ordinal) == 0) ||
                        (activity is WebServiceOutputActivity && String.Compare(((WebServiceOutputActivity)activity).InputActivityName, webServiceFault.InputActivityName, StringComparison.Ordinal) == 0))
                    {
                        if (activity is WebServiceFaultActivity)
                        {
                            validationErrors.Add(new ValidationError(SR.GetString(SR.Error_DuplicateWebServiceFaultFound, activity.Name, webServiceFault.InputActivityName), ErrorNumbers.Error_DuplicateWebServiceFaultFound));
                        }
                        else
                        {
                            validationErrors.Add(new ValidationError(SR.GetString(SR.Error_DuplicateWebServiceResponseFound, activity.Name, webServiceFault.InputActivityName), ErrorNumbers.Error_DuplicateWebServiceResponseFound));
                        }
                        return(validationErrors);
                    }
                }

                foreach (Activity activity in WebServiceActivityHelpers.GetPreceedingActivities(webServiceFault))
                {
                    if (String.Compare(activity.QualifiedName, webServiceFault.InputActivityName, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        if (activity is WebServiceInputActivity)
                        {
                            webServiceReceive    = activity as WebServiceInputActivity;
                            foundMatchingReceive = true;
                        }
                        else
                        {
                            foundMatchingReceive = false;
                            validationErrors.Add(new ValidationError(SR.GetString(SR.Error_WebServiceReceiveNotValid, webServiceFault.InputActivityName), ErrorNumbers.Error_WebServiceReceiveNotValid));
                            return(validationErrors);
                        }
                        break;
                    }
                }

                if (!foundMatchingReceive)
                {
                    validationErrors.Add(new ValidationError(SR.GetString(SR.Error_WebServiceReceiveNotFound, webServiceFault.InputActivityName), ErrorNumbers.Error_WebServiceReceiveNotFound));
                    return(validationErrors);
                }

                Type interfaceType = null;

                if (webServiceReceive.InterfaceType != null)
                {
                    interfaceType = typeProvider.GetType(webServiceReceive.InterfaceType.AssemblyQualifiedName);
                }

                if (interfaceType == null)
                {
                    validationErrors.Add(new ValidationError(SR.GetString(SR.Error_WebServiceReceiveNotConfigured, webServiceReceive.Name), ErrorNumbers.Error_WebServiceReceiveNotConfigured));
                    return(validationErrors);
                }

                // Validate method
                if (String.IsNullOrEmpty(webServiceReceive.MethodName))
                {
                    validationErrors.Add(new ValidationError(SR.GetString(SR.Error_WebServiceReceiveNotConfigured, webServiceReceive.Name), ErrorNumbers.Error_WebServiceReceiveNotConfigured));
                    return(validationErrors);
                }

                MethodInfo methodInfo = Helpers.GetInterfaceMethod(interfaceType, webServiceReceive.MethodName);

                if (methodInfo == null)
                {
                    validationErrors.Add(new ValidationError(SR.GetString(SR.Error_WebServiceReceiveNotConfigured, webServiceReceive.Name), ErrorNumbers.Error_WebServiceReceiveNotConfigured));
                    return(validationErrors);
                }

                List <ParameterInfo> inputParameters, outParameters;
                WebServiceActivityHelpers.GetParameterInfo(methodInfo, out inputParameters, out outParameters);

                if (outParameters.Count == 0)
                {
                    validationErrors.Add(new ValidationError(SR.GetString(SR.Error_WebServiceFaultNotNeeded), ErrorNumbers.Error_WebServiceFaultNotNeeded));
                    return(validationErrors);
                }
            }
            return(validationErrors);
        }
コード例 #14
0
        internal static IEnumerable GetPreceedingActivities(Activity startActivity, bool crossOverLoop)
        {
            Activity         currentActivity = null;
            Stack <Activity> activityStack   = new Stack <Activity>();

            activityStack.Push(startActivity);

            while ((currentActivity = activityStack.Pop()) != null)
            {
                if (currentActivity is CompositeActivity && Helpers.IsCustomActivity((CompositeActivity)currentActivity))
                {
                    break;
                }

                if (currentActivity.Parent != null)
                {
                    foreach (Activity siblingActivity in currentActivity.Parent.Activities)
                    {
                        //
                        if (siblingActivity == currentActivity && ((currentActivity.Parent is ParallelActivity && !Helpers.IsFrameworkActivity(currentActivity)) || (currentActivity.Parent is StateActivity && !Helpers.IsFrameworkActivity(currentActivity))))
                        {
                            continue;
                        }

                        //
                        if (currentActivity.Parent is IfElseActivity && !Helpers.IsFrameworkActivity(currentActivity))
                        {
                            continue;
                        }

                        //For Listen Case.
                        if (currentActivity.Parent is ListenActivity && !Helpers.IsFrameworkActivity(currentActivity))
                        {
                            continue;
                        }

                        // State Machine logic:
                        // If startActivity was in the InitialState, then
                        // there are no preceeding activities.
                        // Otherwise, we just return the parent state as
                        // the preceeding activity.
                        StateActivity currentState = currentActivity.Parent as StateActivity;
                        if (currentState != null)
                        {
                            StateActivity enclosingState = StateMachineHelpers.FindEnclosingState(startActivity);
                            //If we are at Initial State there is no preceeding above us.
                            if (StateMachineHelpers.IsInitialState(enclosingState))
                            {
                                yield break;
                            }
                            else
                            {
                                yield return(currentState);
                            }
                        }

                        if (siblingActivity == currentActivity)
                        {
                            break;
                        }

                        if (siblingActivity.Enabled)
                        {
                            if (siblingActivity is CompositeActivity && !Helpers.IsCustomActivity((CompositeActivity)siblingActivity) && (crossOverLoop || !IsLoopActivity(siblingActivity)))
                            {
                                foreach (Activity containedActivity in WebServiceActivityHelpers.GetContainedActivities((CompositeActivity)siblingActivity))
                                {
                                    yield return(containedActivity);
                                }
                            }
                            else
                            {
                                yield return(siblingActivity);
                            }
                        }
                    }
                }

                if (!crossOverLoop && IsLoopActivity(currentActivity.Parent))
                {
                    break;
                }
                else
                {
                    activityStack.Push(currentActivity.Parent);
                }
            }
            yield break;
        }
コード例 #15
0
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection validationErrors = base.Validate(manager, obj);

            WebServiceOutputActivity webServiceResponse = obj as WebServiceOutputActivity;

            if (webServiceResponse == null)
            {
                throw new ArgumentException(SR.GetString(SR.Error_UnexpectedArgumentType, typeof(WebServiceOutputActivity).FullName), "obj");
            }

            if (Helpers.IsActivityLocked(webServiceResponse))
            {
                return(validationErrors);
            }

            WebServiceInputActivity webServiceReceive = null;

            if (String.IsNullOrEmpty(webServiceResponse.InputActivityName))
            {
                validationErrors.Add(ValidationError.GetNotSetValidationError("InputActivityName"));
            }
            else
            {
                ITypeProvider typeProvider = (ITypeProvider)manager.GetService(typeof(ITypeProvider));
                if (typeProvider == null)
                {
                    throw new InvalidOperationException(SR.GetString(SR.General_MissingService, typeof(ITypeProvider).FullName));
                }

                bool foundMatchingReceive = false;
                foreach (Activity activity in WebServiceActivityHelpers.GetPreceedingActivities(webServiceResponse))
                {
                    if ((activity is WebServiceOutputActivity && String.Compare(((WebServiceOutputActivity)activity).InputActivityName, webServiceResponse.InputActivityName, StringComparison.Ordinal) == 0) ||
                        (activity is WebServiceFaultActivity && String.Compare(((WebServiceFaultActivity)activity).InputActivityName, webServiceResponse.InputActivityName, StringComparison.Ordinal) == 0))
                    {
                        if (activity is WebServiceOutputActivity)
                        {
                            validationErrors.Add(new ValidationError(SR.GetString(SR.Error_DuplicateWebServiceResponseFound, activity.QualifiedName, webServiceResponse.InputActivityName), ErrorNumbers.Error_DuplicateWebServiceResponseFound));
                        }
                        else
                        {
                            validationErrors.Add(new ValidationError(SR.GetString(SR.Error_DuplicateWebServiceFaultFound, activity.QualifiedName, webServiceResponse.InputActivityName), ErrorNumbers.Error_DuplicateWebServiceFaultFound));
                        }
                        return(validationErrors);
                    }
                }

                foreach (Activity activity in WebServiceActivityHelpers.GetPreceedingActivities(webServiceResponse))
                {
                    if (String.Compare(activity.QualifiedName, webServiceResponse.InputActivityName, StringComparison.Ordinal) == 0)
                    {
                        if (activity is WebServiceInputActivity)
                        {
                            webServiceReceive    = activity as WebServiceInputActivity;
                            foundMatchingReceive = true;
                        }
                        else
                        {
                            foundMatchingReceive = false;
                            validationErrors.Add(new ValidationError(SR.GetString(SR.Error_WebServiceReceiveNotValid, webServiceResponse.InputActivityName), ErrorNumbers.Error_WebServiceReceiveNotValid));
                            return(validationErrors);
                        }
                        break;
                    }
                }

                if (!foundMatchingReceive)
                {
                    validationErrors.Add(new ValidationError(SR.GetString(SR.Error_WebServiceReceiveNotFound, webServiceResponse.InputActivityName), ErrorNumbers.Error_WebServiceReceiveNotFound));
                    return(validationErrors);
                }
                else
                {
                    Type interfaceType = null;
                    if (webServiceReceive.InterfaceType != null)
                    {
                        interfaceType = typeProvider.GetType(webServiceReceive.InterfaceType.AssemblyQualifiedName);
                    }

                    if (interfaceType == null)
                    {
                        validationErrors.Add(new ValidationError(SR.GetString(SR.Error_WebServiceReceiveNotConfigured, webServiceReceive.Name), ErrorNumbers.Error_WebServiceReceiveNotConfigured));
                    }
                    else
                    {
                        // Validate method
                        if (String.IsNullOrEmpty(webServiceReceive.MethodName))
                        {
                            validationErrors.Add(new ValidationError(SR.GetString(SR.Error_WebServiceReceiveNotConfigured, webServiceReceive.Name), ErrorNumbers.Error_WebServiceReceiveNotConfigured));
                        }
                        else
                        {
                            MethodInfo methodInfo = Helpers.GetInterfaceMethod(interfaceType, webServiceReceive.MethodName);

                            if (methodInfo == null)
                            {
                                validationErrors.Add(new ValidationError(SR.GetString(SR.Error_WebServiceReceiveNotConfigured, webServiceReceive.Name), ErrorNumbers.Error_WebServiceReceiveNotConfigured));
                            }
                            else
                            {
                                ValidationErrorCollection parameterTypeErrors = WebServiceActivityHelpers.ValidateParameterTypes(methodInfo);
                                if (parameterTypeErrors.Count > 0)
                                {
                                    foreach (ValidationError parameterTypeError in parameterTypeErrors)
                                    {
                                        parameterTypeError.PropertyName = "InputActivityName";
                                    }
                                    validationErrors.AddRange(parameterTypeErrors);
                                }
                                else
                                {
                                    List <ParameterInfo> inputParameters, outParameters;
                                    WebServiceActivityHelpers.GetParameterInfo(methodInfo, out inputParameters, out outParameters);

                                    if (outParameters.Count == 0)
                                    {
                                        validationErrors.Add(new ValidationError(SR.GetString(SR.Error_WebServiceResponseNotNeeded), ErrorNumbers.Error_WebServiceResponseNotNeeded));
                                    }
                                    else
                                    {
                                        // Check to see if all output parameters have a valid bindings.
                                        foreach (ParameterInfo paramInfo in outParameters)
                                        {
                                            string paramName = paramInfo.Name;
                                            Type   paramType = paramInfo.ParameterType.IsByRef ? paramInfo.ParameterType.GetElementType() : paramInfo.ParameterType;

                                            if (paramInfo.Position == -1)
                                            {
                                                paramName = "(ReturnValue)";
                                            }

                                            object paramValue = null;
                                            if (webServiceResponse.ParameterBindings.Contains(paramName))
                                            {
                                                if (webServiceResponse.ParameterBindings[paramName].IsBindingSet(WorkflowParameterBinding.ValueProperty))
                                                {
                                                    paramValue = webServiceResponse.ParameterBindings[paramName].GetBinding(WorkflowParameterBinding.ValueProperty);
                                                }
                                                else
                                                {
                                                    paramValue = webServiceResponse.ParameterBindings[paramName].GetValue(WorkflowParameterBinding.ValueProperty);
                                                }
                                            }

                                            if (!paramType.IsPublic || !paramType.IsSerializable)
                                            {
                                                ValidationError validationError = new ValidationError(SR.GetString(SR.Error_TypeNotPublicSerializable, paramName, paramType.FullName), ErrorNumbers.Error_TypeNotPublicSerializable);
                                                validationError.PropertyName = (String.Compare(paramName, "(ReturnValue)", StringComparison.Ordinal) == 0) ? paramName : ParameterInfoBasedPropertyDescriptor.GetParameterPropertyName(webServiceReceive.GetType(), paramName);
                                                validationErrors.Add(validationError);
                                            }
                                            else if (!webServiceResponse.ParameterBindings.Contains(paramName) || paramValue == null)
                                            {
                                                ValidationError validationError = ValidationError.GetNotSetValidationError(paramName);
                                                validationError.PropertyName = (String.Compare(paramName, "(ReturnValue)", StringComparison.Ordinal) == 0) ? paramName : ParameterInfoBasedPropertyDescriptor.GetParameterPropertyName(webServiceReceive.GetType(), paramName);
                                                validationErrors.Add(validationError);
                                            }
                                            else
                                            {
                                                AccessTypes access = AccessTypes.Read;
                                                if (paramInfo.IsOut || paramInfo.IsRetval || paramInfo.Position == -1)
                                                {
                                                    access = AccessTypes.Write;
                                                }

                                                ValidationErrorCollection variableErrors = ValidationHelpers.ValidateProperty(manager, webServiceResponse, paramValue,
                                                                                                                              new PropertyValidationContext(webServiceResponse.ParameterBindings[paramName], null, paramName), new BindValidationContext(paramInfo.ParameterType.IsByRef ? paramInfo.ParameterType.GetElementType() : paramInfo.ParameterType, access));
                                                foreach (ValidationError variableError in variableErrors)
                                                {
                                                    if (String.Compare(paramName, "(ReturnValue)", StringComparison.Ordinal) != 0)
                                                    {
                                                        variableError.PropertyName = ParameterInfoBasedPropertyDescriptor.GetParameterPropertyName(webServiceReceive.GetType(), paramName);
                                                    }
                                                }
                                                validationErrors.AddRange(variableErrors);
                                            }
                                        }

                                        if (webServiceResponse.ParameterBindings.Count > outParameters.Count)
                                        {
                                            validationErrors.Add(new ValidationError(SR.GetString(SR.Warning_AdditionalBindingsFound), ErrorNumbers.Warning_AdditionalBindingsFound, true));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(validationErrors);
        }
コード例 #16
0
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection errors   = base.Validate(manager, obj);
            WebServiceInputActivity   activity = obj as WebServiceInputActivity;

            if (activity == null)
            {
                throw new ArgumentException(SR.GetString("Error_UnexpectedArgumentType", new object[] { typeof(WebServiceInputActivity).FullName }), "obj");
            }
            if (!Helpers.IsActivityLocked(activity))
            {
                List <ParameterInfo> list;
                List <ParameterInfo> list2;
                if (activity.IsActivating)
                {
                    if (WebServiceActivityHelpers.GetPreceedingActivities(activity).GetEnumerator().MoveNext())
                    {
                        ValidationError item = new ValidationError(SR.GetString("Error_ActivationActivityNotFirst"), 0x568)
                        {
                            PropertyName = "IsActivating"
                        };
                        errors.Add(item);
                        return(errors);
                    }
                    if (WebServiceActivityHelpers.IsInsideLoop(activity, null))
                    {
                        ValidationError error2 = new ValidationError(SR.GetString("Error_ActivationActivityInsideLoop"), 0x579)
                        {
                            PropertyName = "IsActivating"
                        };
                        errors.Add(error2);
                        return(errors);
                    }
                }
                else if (!WebServiceActivityHelpers.GetPreceedingActivities(activity, true).GetEnumerator().MoveNext())
                {
                    ValidationError error3 = new ValidationError(SR.GetString("Error_WebServiceReceiveNotMarkedActivate"), 0x569)
                    {
                        PropertyName = "IsActivating"
                    };
                    errors.Add(error3);
                    return(errors);
                }
                ITypeProvider service = (ITypeProvider)manager.GetService(typeof(ITypeProvider));
                if (service == null)
                {
                    throw new InvalidOperationException(SR.GetString("General_MissingService", new object[] { typeof(ITypeProvider).FullName }));
                }
                Type interfaceType = null;
                if (activity.InterfaceType != null)
                {
                    interfaceType = service.GetType(activity.InterfaceType.AssemblyQualifiedName);
                }
                if (interfaceType == null)
                {
                    ValidationError error4 = new ValidationError(SR.GetString("Error_TypePropertyInvalid", new object[] { "InterfaceType" }), 0x116)
                    {
                        PropertyName = "InterfaceType"
                    };
                    errors.Add(error4);
                    return(errors);
                }
                if (!interfaceType.IsInterface)
                {
                    ValidationError error5 = new ValidationError(SR.GetString("Error_InterfaceTypeNotInterface", new object[] { "InterfaceType" }), 0x570)
                    {
                        PropertyName = "InterfaceType"
                    };
                    errors.Add(error5);
                    return(errors);
                }
                if (string.IsNullOrEmpty(activity.MethodName))
                {
                    errors.Add(ValidationError.GetNotSetValidationError("MethodName"));
                    return(errors);
                }
                MethodInfo interfaceMethod = Helpers.GetInterfaceMethod(interfaceType, activity.MethodName);
                if (interfaceMethod == null)
                {
                    ValidationError error6 = new ValidationError(SR.GetString("Error_MethodNotExists", new object[] { "MethodName", activity.MethodName }), 0x137)
                    {
                        PropertyName = "MethodName"
                    };
                    errors.Add(error6);
                    return(errors);
                }
                ValidationErrorCollection errors2 = WebServiceActivityHelpers.ValidateParameterTypes(interfaceMethod);
                if (errors2.Count > 0)
                {
                    foreach (ValidationError error7 in errors2)
                    {
                        error7.PropertyName = "MethodName";
                    }
                    errors.AddRange(errors2);
                    return(errors);
                }
                WebServiceActivityHelpers.GetParameterInfo(interfaceMethod, out list, out list2);
                foreach (ParameterInfo info2 in list)
                {
                    string name = info2.Name;
                    string parameterPropertyName = ParameterInfoBasedPropertyDescriptor.GetParameterPropertyName(activity.GetType(), name);
                    Type   type2   = info2.ParameterType.IsByRef ? info2.ParameterType.GetElementType() : info2.ParameterType;
                    object binding = null;
                    if (activity.ParameterBindings.Contains(name))
                    {
                        if (activity.ParameterBindings[name].IsBindingSet(WorkflowParameterBinding.ValueProperty))
                        {
                            binding = activity.ParameterBindings[name].GetBinding(WorkflowParameterBinding.ValueProperty);
                        }
                        else
                        {
                            binding = activity.ParameterBindings[name].GetValue(WorkflowParameterBinding.ValueProperty);
                        }
                    }
                    if (!type2.IsPublic || !type2.IsSerializable)
                    {
                        ValidationError error8 = new ValidationError(SR.GetString("Error_TypeNotPublicSerializable", new object[] { name, type2.FullName }), 0x567)
                        {
                            PropertyName = parameterPropertyName
                        };
                        errors.Add(error8);
                    }
                    else if (!activity.ParameterBindings.Contains(name) || (binding == null))
                    {
                        ValidationError notSetValidationError = ValidationError.GetNotSetValidationError(name);
                        notSetValidationError.PropertyName = parameterPropertyName;
                        errors.Add(notSetValidationError);
                    }
                    else
                    {
                        AccessTypes read = AccessTypes.Read;
                        if (info2.ParameterType.IsByRef)
                        {
                            read |= AccessTypes.Write;
                        }
                        ValidationErrorCollection errors3 = System.Workflow.Activities.Common.ValidationHelpers.ValidateProperty(manager, activity, binding, new PropertyValidationContext(activity.ParameterBindings[name], null, name), new BindValidationContext(info2.ParameterType.IsByRef ? info2.ParameterType.GetElementType() : info2.ParameterType, read));
                        foreach (ValidationError error10 in errors3)
                        {
                            error10.PropertyName = parameterPropertyName;
                        }
                        errors.AddRange(errors3);
                    }
                }
                if (activity.ParameterBindings.Count > list.Count)
                {
                    errors.Add(new ValidationError(SR.GetString("Warning_AdditionalBindingsFound"), 0x630, true));
                }
                bool flag = false;
                foreach (Activity activity2 in WebServiceActivityHelpers.GetSucceedingActivities(activity))
                {
                    if (((activity2 is WebServiceOutputActivity) && (((WebServiceOutputActivity)activity2).InputActivityName == activity.Name)) || ((activity2 is WebServiceFaultActivity) && (((WebServiceFaultActivity)activity2).InputActivityName == activity.Name)))
                    {
                        flag = true;
                        break;
                    }
                }
                if (((list2.Count > 0) || (interfaceMethod.ReturnType != typeof(void))) && !flag)
                {
                    errors.Add(new ValidationError(SR.GetString("Error_WebServiceResponseNotFound"), 0x55d));
                }
            }
            return(errors);
        }