Пример #1
0
        /// <summary>
        /// Maps from a domain model representation of an AS4 usermessage to an XML representation of an AS4 routing usermessage.
        /// </summary>
        /// <param name="model">The domain model to convert.</param>
        internal static Xml.RoutingInputUserMessage ConvertToRouting(Model.Core.UserMessage model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            var r = new Xml.RoutingInputUserMessage
            {
                MessageInfo = new Xml.MessageInfo
                {
                    MessageId      = model.MessageId,
                    RefToMessageId = model.RefToMessageId,
                    Timestamp      = model.Timestamp.LocalDateTime
                },
                mpc = model.Mpc,
                CollaborationInfo = MapCollaborationInfo(model.CollaborationInfo),
                PartyInfo         = MapPartyInfo(model.Receiver, model.Sender),
                MessageProperties = MapMessageProperties(model.MessageProperties),
                PayloadInfo       = MapPartInfos(model.PayloadInfo)
            };

            r.mpc = r.mpc ?? Constants.Namespaces.EbmsDefaultMpc;
            r.CollaborationInfo.Action = r.CollaborationInfo.Action + ".response";

            return(r);
        }
Пример #2
0
        /// <summary>
        /// Maps from a domain model representation to an XML representation of an AS4 usermessage.
        /// </summary>
        /// <param name="model">The domain model to convert.</param>
        internal static Xml.UserMessage Convert(Model.Core.UserMessage model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            return(new Xml.UserMessage
            {
                MessageInfo = new Xml.MessageInfo
                {
                    MessageId = model.MessageId,
                    RefToMessageId = model.RefToMessageId,
                    Timestamp = model.Timestamp.LocalDateTime
                },
                mpc = model.Mpc,
                CollaborationInfo = MapCollaborationInfo(model.CollaborationInfo),
                PartyInfo = MapPartyInfo(model.Sender, model.Receiver),
                PayloadInfo = MapPartInfos(model.PayloadInfo),
                MessageProperties = MapMessageProperties(model.MessageProperties)
            });
        }