Validate() private method

private Validate ( OperationDescription od, bool isRpc, bool isEncoded ) : void
od System.ServiceModel.Description.OperationDescription
isRpc bool
isEncoded bool
return void
Esempio n. 1
0
        public PrimitiveOperationFormatter(OperationDescription description, bool isRpc)
        {
            if (description == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("description");
            }

            OperationFormatter.Validate(description, isRpc, false /*isEncoded*/);

            this.operation = description;
#pragma warning suppress 56506 // Microsoft, OperationDescription.Messages never be null
            this.requestMessage = description.Messages[0];
            if (description.Messages.Count == 2)
            {
                this.responseMessage = description.Messages[1];
            }

            int stringCount = 3 + requestMessage.Body.Parts.Count;
            if (responseMessage != null)
            {
                stringCount += 2 + responseMessage.Body.Parts.Count;
            }

            XmlDictionary dictionary = new XmlDictionary(stringCount * 2);

            xsiNilLocalName = dictionary.Add("nil");
            xsiNilNamespace = dictionary.Add(System.Xml.Schema.XmlSchema.InstanceNamespace);

            OperationFormatter.GetActions(description, dictionary, out this.action, out this.replyAction);

            if (requestMessage.Body.WrapperName != null)
            {
                requestWrapperName      = AddToDictionary(dictionary, requestMessage.Body.WrapperName);
                requestWrapperNamespace = AddToDictionary(dictionary, requestMessage.Body.WrapperNamespace);
            }

            requestParts = AddToDictionary(dictionary, requestMessage.Body.Parts, isRpc);

            if (responseMessage != null)
            {
                if (responseMessage.Body.WrapperName != null)
                {
                    responseWrapperName      = AddToDictionary(dictionary, responseMessage.Body.WrapperName);
                    responseWrapperNamespace = AddToDictionary(dictionary, responseMessage.Body.WrapperNamespace);
                }

                responseParts = AddToDictionary(dictionary, responseMessage.Body.Parts, isRpc);

                if (responseMessage.Body.ReturnValue != null && responseMessage.Body.ReturnValue.Type != typeof(void))
                {
                    returnPart = AddToDictionary(dictionary, responseMessage.Body.ReturnValue, isRpc);
                }
            }
        }
Esempio n. 2
0
        public PrimitiveOperationFormatter(OperationDescription description, bool isRpc)
        {
            if (description == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("description");
            }

            OperationFormatter.Validate(description, isRpc, false /*isEncoded*/);

            _operation      = description;
            _requestMessage = description.Messages[0];
            if (description.Messages.Count == 2)
            {
                _responseMessage = description.Messages[1];
            }

            int stringCount = 3 + _requestMessage.Body.Parts.Count;

            if (_responseMessage != null)
            {
                stringCount += 2 + _responseMessage.Body.Parts.Count;
            }

            XmlDictionary dictionary = new XmlDictionary(stringCount * 2);

            _xsiNilLocalName = dictionary.Add("nil");
            _xsiNilNamespace = dictionary.Add(EndpointAddressProcessor.XsiNs);

            OperationFormatter.GetActions(description, dictionary, out _action, out _replyAction);

            if (_requestMessage.Body.WrapperName != null)
            {
                _requestWrapperName      = AddToDictionary(dictionary, _requestMessage.Body.WrapperName);
                _requestWrapperNamespace = AddToDictionary(dictionary, _requestMessage.Body.WrapperNamespace);
            }

            _requestParts = AddToDictionary(dictionary, _requestMessage.Body.Parts, isRpc);

            if (_responseMessage != null)
            {
                if (_responseMessage.Body.WrapperName != null)
                {
                    _responseWrapperName      = AddToDictionary(dictionary, _responseMessage.Body.WrapperName);
                    _responseWrapperNamespace = AddToDictionary(dictionary, _responseMessage.Body.WrapperNamespace);
                }

                _responseParts = AddToDictionary(dictionary, _responseMessage.Body.Parts, isRpc);

                if (_responseMessage.Body.ReturnValue != null && _responseMessage.Body.ReturnValue.Type != typeof(void))
                {
                    _returnPart = AddToDictionary(dictionary, _responseMessage.Body.ReturnValue, isRpc);
                }
            }
        }
Esempio n. 3
0
        public PrimitiveOperationFormatter(OperationDescription description, bool isRpc)
        {
            if (description == null)
            {
                throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("description");
            }
            OperationFormatter.Validate(description, isRpc, false);
            this.operation      = description;
            this.requestMessage = description.Messages[0];
            if (description.Messages.Count == 2)
            {
                this.responseMessage = description.Messages[1];
            }
            int num = 3 + this.requestMessage.Body.Parts.Count;

            if (this.responseMessage != null)
            {
                num += 2 + this.responseMessage.Body.Parts.Count;
            }
            XmlDictionary dictionary = new XmlDictionary(num * 2);

            this.xsiNilLocalName = dictionary.Add("nil");
            this.xsiNilNamespace = dictionary.Add("http://www.w3.org/2001/XMLSchema-instance");
            OperationFormatter.GetActions(description, dictionary, out this.action, out this.replyAction);
            if (this.requestMessage.Body.WrapperName != null)
            {
                this.requestWrapperName      = AddToDictionary(dictionary, this.requestMessage.Body.WrapperName);
                this.requestWrapperNamespace = AddToDictionary(dictionary, this.requestMessage.Body.WrapperNamespace);
            }
            this.requestParts = AddToDictionary(dictionary, this.requestMessage.Body.Parts, isRpc);
            if (this.responseMessage != null)
            {
                if (this.responseMessage.Body.WrapperName != null)
                {
                    this.responseWrapperName      = AddToDictionary(dictionary, this.responseMessage.Body.WrapperName);
                    this.responseWrapperNamespace = AddToDictionary(dictionary, this.responseMessage.Body.WrapperNamespace);
                }
                this.responseParts = AddToDictionary(dictionary, this.responseMessage.Body.Parts, isRpc);
                if ((this.responseMessage.Body.ReturnValue != null) && (this.responseMessage.Body.ReturnValue.Type != typeof(void)))
                {
                    this.returnPart = AddToDictionary(dictionary, this.responseMessage.Body.ReturnValue, isRpc);
                }
            }
        }