private void ValidateMethod(IWebServiceMethodDescription method)
        {
            Assert.IsFalse(string.IsNullOrEmpty(method.Name));

            foreach (var parameter in method.InputParameters.Where(p => !p.IsSoapHeader))
            {
                Assert.IsFalse(string.IsNullOrEmpty(parameter.Name));
                Assert.IsNotNull(method.DeclaringService.FindTypeByName(parameter.TypeName));
            }

            foreach (var header in method.InputParameters.Where(p => p.IsSoapHeader))
            {
                Assert.IsFalse(string.IsNullOrEmpty(header.Name));
                Assert.IsNotNull(method.DeclaringService.FindTypeByName(header.TypeName));
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="WebServiceMethodParameterDescription"/> class.
        /// </summary>
        /// <param name="declaringMethod">
        /// The declaring method.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="declaringMethod"/> parameter is null.
        /// </exception>
        public WebServiceMethodParameterDescription(IWebServiceMethodDescription declaringMethod)
        {
            if (declaringMethod == null)
                throw new ArgumentNullException("declaringMethod");

            _declaringMethod = declaringMethod;
        }
        /// <summary>
        /// Edits the <see cref="WebMethodCallSettingsEdit.ResultMapping"/> expression.
        /// </summary>
        /// <param name="parentWindow">
        /// The parent window.
        /// </param>
        /// <param name="method">
        /// The method.
        /// </param>
        /// <param name="process">
        /// The process.
        /// </param>
        /// <param name="callSettings">
        /// The call settings.
        /// </param>
        public void EditExpression(
            ITopLevelWindow parentWindow,
            IWebServiceMethodDescription method,
            IProcessEdit process,
            WebMethodCallSettingsEdit callSettings)
        {
            SaveAction = CreateSaveAction(callSettings);
            RemoveAction = CreateRemoveAction(callSettings);

            ExpressionDesigner.Value.LoadFromExpressionObjects(new List<IExpressionObjectBase>());
            WindowManager.Value.ShowStatus(new Status { IsBusy = true });

            var expressions = new List<IExpressionObjectBase>();
            var newExpressions = new List<IExpressionObjectBase>();

            var syncContext = new NotifyClientAction(
                () =>
                {
                    ExpressionDesigner.Value.LoadFromExpressionObjects(expressions);
                    WindowManager.Value.ShowStatus(new Status());
                });

            syncContext.OperationStarted();

            newExpressions.Add(
                CreateSourceItem(
                    "Soap Headers",
                    Constants.WebMethodCallOutputHeadersExpressionName,
                    10,
                    10,
                    method.OutputParameters.Where(p => p.IsSoapHeader),
                    callSettings.ResultFields));
            newExpressions.Add(
                CreateSourceItem(
                    "Output Parameters",
                    Constants.WebMethodCallOutputParametersExpressionName,
                    160,
                    10,
                    method.OutputParameters.Where(p => !p.IsSoapHeader),
                    callSettings.ResultFields));
            newExpressions.Add(CreateUserInformationItem(CurrentUserInformationItemName, 310, 10));
            newExpressions.Add(CreateDestinationItem(process));

            if (!string.IsNullOrWhiteSpace(callSettings.ResultMapping))
            {
                try
                {
                    var expressionsContainer = Serializer.Deserialize(callSettings.ResultMapping);
                    expressions.AddRange(expressionsContainer.Expressions);
                }
                catch
                {
                    // Do nothing, new expressions will be used.
                }
            }

            UpdateStateList(process);

            UpdateStoredExpressions(expressions, newExpressions, syncContext);

            syncContext.OperationCompleted();
            WindowManager.Value.ShowChildWindow(parentWindow, this);
        }