/// <summary>
 /// Creates a <see cref="WSTrustChannel" /> using parameters that reflect the configuration of
 /// this factory.
 /// </summary>
 /// <param name="innerChannel">The channel created by the base class capable of sending and
 /// receiving messages.</param>
 /// <param name="trustVersion">The version of WS-Trust that should be used.</param>
 /// <param name="context">
 /// The <see cref="WSTrustSerializationContext" /> that should be used to serialize WS-Trust messages.
 /// </param>
 /// <param name="requestSerializer">
 /// The <see cref="WSTrustRequestSerializer" /> that should be used to serialize WS-Trust request messages.
 /// </param>
 /// <param name="responseSerializer">
 /// The <see cref="WSTrustResponseSerializer" /> that should be used to serialize WS-Trust response messages.
 /// </param>
 /// <returns></returns>
 protected virtual WSTrustChannel CreateTrustChannel(IWSTrustChannelContract innerChannel,
                                                     TrustVersion trustVersion,
                                                     WSTrustSerializationContext context,
                                                     WSTrustRequestSerializer requestSerializer,
                                                     WSTrustResponseSerializer responseSerializer)
 {
     return(new WSTrustChannel(this, innerChannel, trustVersion, context, requestSerializer, responseSerializer));
 }
        /// <summary>
        /// Constructs the Body Writer.
        /// </summary>
        /// <param name="serializer">Serializer to use for serializing the rst.</param>
        /// <param name="rst">The RequestSecurityToken object to be serialized to the outgoing Message.</param>
        public RequestBodyWriter(WSTrustRequestSerializer serializer, RequestSecurityToken rst)
            : base(false)
        {
            if (serializer == null)
                throw new ArgumentNullException("serializer");

            this._serializer = serializer;
            this._rst = rst;
        }
 public RequestBodyWriter(WSTrustRequestSerializer serializer, RequestSecurityToken rst)
     : base(false)
 {
     if (serializer == null)
     {
         throw new ArgumentNullException("serializer");
     }
     this._serializer = serializer;
     this._rst        = rst;
 }
        /// <summary>
        /// Constructor for the WSTrustRequestBodyWriter.
        /// </summary>
        /// <param name="requestSecurityToken">The RequestSecurityToken object to be serialized in the outgoing Message.</param>
        /// <param name="serializer">Serializer is responsible for writting the requestSecurityToken into a XmlDictionaryWritter.</param>
        /// <param name="serializationContext">Context for the serialization.</param>
        /// <exception cref="ArgumentNullException">The 'requestSecurityToken' is null.</exception>
        /// <exception cref="ArgumentNullException">The 'serializer' is null.</exception>
        /// <exception cref="ArgumentNullException">The 'serializationContext' is null.</exception>
        public WSTrustRequestBodyWriter(System.IdentityModel.Protocols.WSTrust.RequestSecurityToken requestSecurityToken, WSTrustRequestSerializer serializer, WSTrustSerializationContext serializationContext)
            : base(true)
        {
            if (requestSecurityToken == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("requestSecurityToken");
            }

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

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

            _requestSecurityToken = requestSecurityToken;
            _serializer           = serializer;
            _serializationContext = serializationContext;
        }