public override object Invoke(XsltContext xsltContext, object[] args, XPathNavigator docContext)
        {
            CorrelationDataMessageProperty property;
            string str;
            SeekableMessageNavigator navigator = docContext as SeekableMessageNavigator;

            if ((navigator != null) && (CorrelationDataMessageProperty.TryGet(navigator.Message, out property) && property.TryGetValue((string)args[0], out str)))
            {
                return(str);
            }
            return(string.Empty);
        }
Пример #2
0
        public static Message CreateMessage()
        {
            StringReader  stringReader = new StringReader(messageBody);
            XmlTextReader xmlReader    = new XmlTextReader(stringReader);
            Message       message      = Message.CreateMessage(MessageVersion.Soap12WSAddressing10, "http://purchaseorder", xmlReader);

            // Add two correlation properties using lambda expressions. The property names are
            // CorrelationData1 and CorrelationData2. The first goes to "value1" and the
            // second to "value2". You can use your own property names and values.
            CorrelationDataMessageProperty data = new CorrelationDataMessageProperty();

            data.Add("CorrelationData1", () => "value1");
            data.Add("CorrelationData2", () => "value2");
            message.Properties[CorrelationDataMessageProperty.Name] = data;

            return(message);
        }
        internal override void InvokeInternal(ProcessingContext context, int argCount)
        {
            StackFrame topArg         = context.TopArg;
            Message    contextMessage = context.Processor.ContextMessage;
            CorrelationDataMessageProperty property = null;

            CorrelationDataMessageProperty.TryGet(contextMessage, out property);
            while (topArg.basePtr <= topArg.endPtr)
            {
                string str;
                if ((property == null) || !property.TryGetValue(context.PeekString(topArg.basePtr), out str))
                {
                    str = string.Empty;
                }
                context.SetValue(context, topArg.basePtr, str);
                topArg.basePtr++;
            }
        }