コード例 #1
0
        public void WriteResponseToStream(LegacyResponse legacyResponse, Stream writeStream)
        {
            var request = legacyResponse.Request;

            var body = request.GetSoapBody();
            var operationElement = _legacyMessageParser.GetOperationElement(body);
            var operationElementName = operationElement.Name;
            var namespaceName = operationElementName.NamespaceName;
            var operationName = operationElementName.LocalName;

            var operationResultInnerElement = new XElement(
                string.Concat("{", namespaceName, "}", operationName, "Result"));

            var processResult = legacyResponse.ProcessingResult;
            if (processResult != null)
            {
                operationResultInnerElement.Add(processResult);
            }

            var operationResultOuterElement = new XElement(
                string.Concat("{", namespaceName, "}", operationName, "Response"));
            operationResultOuterElement.Add(operationResultInnerElement);

            operationElement.ReplaceWith(operationResultOuterElement);

            using (var outWriter = new XmlTextWriter(writeStream, Encoding.UTF8))
            {
                request.WriteTo(outWriter);
                outWriter.Flush();
            }
        }
コード例 #2
0
        public void WriteResponseToStream(LegacyResponse legacyResponse, Stream writeStream)
        {
            var request = legacyResponse.Request;

            var body                 = request.GetSoapBody();
            var operationElement     = _legacyMessageParser.GetOperationElement(body);
            var operationElementName = operationElement.Name;
            var namespaceName        = operationElementName.NamespaceName;
            var operationName        = operationElementName.LocalName;

            var operationResultInnerElement = new XElement(
                string.Concat("{", namespaceName, "}", operationName, "Result"));

            var processResult = legacyResponse.ProcessingResult;

            if (processResult != null)
            {
                operationResultInnerElement.Add(processResult);
            }

            var operationResultOuterElement = new XElement(
                string.Concat("{", namespaceName, "}", operationName, "Response"));

            operationResultOuterElement.Add(operationResultInnerElement);

            operationElement.ReplaceWith(operationResultOuterElement);

            using (var outWriter = new XmlTextWriter(writeStream, Encoding.UTF8))
            {
                request.WriteTo(outWriter);
                outWriter.Flush();
            }
        }
コード例 #3
0
        public virtual LegacyResponse ProcessLegacyMessage(XDocument request)
        {
            var operationElement = _legacyMessageParser.GetOperationElement(request);
            var opName = operationElement.Name.LocalName;

            foreach (var legacyMessageProcessingStrategy in _legacyMessageProcessingStrategies)
            {
                if (legacyMessageProcessingStrategy.CanProcess(opName))
                {
                    var legacyResponse = new LegacyResponse
                    {
                        Request = request,
                        ProcessingResult = legacyMessageProcessingStrategy.Execute(operationElement)
                    };
                    return legacyResponse;
                }
            }

            throw new NotSupportedException(opName);
        }
コード例 #4
0
        public virtual LegacyResponse ProcessLegacyMessage(XDocument request)
        {
            var operationElement = _legacyMessageParser.GetOperationElement(request);
            var opName           = operationElement.Name.LocalName;

            foreach (var legacyMessageProcessingStrategy in _legacyMessageProcessingStrategies)
            {
                if (legacyMessageProcessingStrategy.CanProcess(opName))
                {
                    var legacyResponse = new LegacyResponse
                    {
                        Request          = request,
                        ProcessingResult = legacyMessageProcessingStrategy.Execute(operationElement)
                    };
                    return(legacyResponse);
                }
            }

            throw new NotSupportedException(opName);
        }