/// <summary>
        /// Serializes a RequestSecurityTokenResponse object to the given XmlWriter
        /// stream.
        /// </summary>
        /// <param name="response">RequestSecurityTokenResponse object that needs to be serialized to the writer.</param>
        /// <param name="writer">XmlWriter into which the object will be serialized</param>
        /// <param name="context">Current Serialization context.</param>
        /// <exception cref="ArgumentNullException">The given response or writer or context parameter is null</exception>
        public override void WriteXml(RequestSecurityTokenResponse response, XmlWriter writer, WSTrustSerializationContext context)
        {
            if (response == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("response");
            }

            if (writer == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer");
            }

            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }

            if (response.IsFinal)
            {
                writer.WriteStartElement(WSTrust13Constants.Prefix, WSTrust13Constants.ElementNames.RequestSecurityTokenResponseCollection, WSTrust13Constants.NamespaceURI);
            }

            WSTrustSerializationHelper.WriteResponse(response, writer, context, this, WSTrustConstantsAdapter.Trust13);

            if (response.IsFinal)
            {
                writer.WriteEndElement();
            }
        }
Exemple #2
0
        /// <summary>
        /// Serializes the given RequestSecurityTokenResponse into the XmlWriter
        /// </summary>
        /// <param name="response">RequestSecurityTokenRespone object to be serialized</param>
        /// <param name="writer">XML writer to serialize into</param>
        /// <param name="context">Current Serialization context.</param>
        /// <exception cref="ArgumentNullException">The response or writer or context parameter is null.</exception>
        public override void WriteXml(RequestSecurityTokenResponse response, XmlWriter writer, WSTrustSerializationContext context)
        {
            if (response == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("response");
            }

            if (writer == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer");
            }

            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }

            WSTrustSerializationHelper.WriteResponse(response, writer, context, this, WSTrustConstantsAdapter.TrustFeb2005);
        }