Exemplo n.º 1
0
        /// <summary>
        /// Creates a sample notification message using the FpML 'serviceNotification'
        /// element.
        /// </summary>
        /// <param name="context">Identifies the user.</param>
        /// <returns>The payload of the notification message.</returns>
        private string CreateNotificationMessage(UserContext context)
        {
            Builder builder = CreateMessage(Releases.R5_9_CONFIRMATION, "serviceNotification", context, null);

            builder.AppendElementAndText("serviceName", "FpMLWebServices");
            builder.AppendElementAndText("status", "Available");

            return(NestedWriter.ToString(builder.Document));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a response message for a message that passed full validation.
        /// </summary>
        /// <param name="release">The FpML release to respond with.</param>
        /// <param name="context">Identifies the user.</param>
        /// <param name="document">The parsed form of the input messsage.</param>
        /// <returns></returns>
        private string CreateAcceptedMessage(SchemaRelease release, UserContext context, XmlDocument document)
        {
            Builder builder = CreateMessage(release, "serviceNotification", context, document);

            builder.AppendElementAndText("serviceName", "FpMLWebServices");
            builder.AppendElement("advisory");
            builder.AppendElementAndText("categpry", "Rules");
            builder.AppendElementAndText("description", "Message was accepted");
            builder.CloseElement();

            return(NestedWriter.ToString(builder.Document));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a response message for a message that failed XML or FpML
        /// validation.
        /// </summary>
        /// <param name="release">The FpML release to respond with.</param>
        /// <param name="context">Identifies the user.</param>
        /// <param name="document">The parsed form of the input messsage or <b>null</b>.</param>
        /// <param name="errorSet">The set of detected errors.</param>
        /// <returns></returns>
        private string CreateRejectedMessage(SchemaRelease release, UserContext context, XmlDocument document,
                                             ValidationErrorSet errorSet)
        {
            Builder builder = CreateMessage(release, "messageRejected", context, document);

            for (int index = 0; index < errorSet.Count; ++index)
            {
                ValidationError error = errorSet [index];

                builder.AppendElement("reason");

                builder.AppendElementAndText("reasonCode", error.Code);

                builder.AppendElement("location");
                builder.SetAttribute("locationType", error.IsLexical ? "lexical" : "xpath");
                builder.AppendText(error.Context);
                builder.CloseElement();

                if (error.Description != null)
                {
                    builder.AppendElementAndText("description", error.Description);
                }

                if (error.RuleName != null)
                {
                    builder.AppendElementAndText("validationRuleId", error.RuleName);
                }

                if (error.AdditionalData != null)
                {
                    builder.AppendElement("additionalData");
                    builder.AppendElementAndText("string", error.AdditionalData);
                    builder.CloseElement();
                }

                builder.CloseElement();
            }

            return(NestedWriter.ToString(builder.Document));
        }