示例#1
0
        /// <summary>
        /// Constructs a <see cref="WSTrustChannel" />.
        /// </summary>
        /// <param name="requestChannel">The <see cref="IRequestChannel" /> this channel will be used to send a <see cref="WsTrustRequest" /> to the STS.</param>
        public WSTrustChannel(IRequestChannel requestChannel)
        {
            RequestChannel = requestChannel ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(requestChannel));
            if (requestChannel.State != CommunicationState.Created)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(LogHelper.FormatInvariant(SR.GetResourceString(SR.IRequestChannelMustBeCreated), requestChannel.State)));
            }

            MessageVersion = RequestChannel.GetProperty <MessageVersion>();
            if (MessageVersion == null || MessageVersion == MessageVersion.None)
            {
                MessageVersion = MessageVersion.Default;
            }

            EndpointAddress endpointAddress = RequestChannel.GetProperty <EndpointAddress>();

            if (endpointAddress != null)
            {
                Address = endpointAddress.Uri?.AbsoluteUri;
            }
        }
示例#2
0
 /// <summary>
 /// Returns a typed object requested, if present, from the appropriate layer in the channel stack.
 /// </summary>
 /// <typeparam name="T">The typed object for which the method is querying.</typeparam>
 /// <returns>The typed object <typeparamref name="T"/> requested if present, null if not found.</returns>
 public T GetProperty <T>() where T : class
 {
     return(RequestChannel.GetProperty <T>());
 }