Uri EnsureAnonymous(Message message)
        {
            Uri to;

            if (IsDatagram)
            {
                to = message.Headers.To;
            }
            else
            {
                to = this.RemoteAddress.Uri;
            }

            if (to == null)
            {
                throw new InvalidOperationException(ExceptionMessages.WsmcNoToHeader);
            }
            else if (!MakeConnectionUtility.IsAnonymousUri(to))
            {
                throw new InvalidOperationException(String.Format
                                                        (ExceptionMessages.WsmcNotAnonUri, to));
            }

            return(to);
        }
        ChannelProtectionRequirements GetProtectionRequirements()
        {
            // Listing headers that must be signed.
            ChannelProtectionRequirements result = new ChannelProtectionRequirements();
            MessagePartSpecification      signedReliabilityMessageParts = MakeConnectionUtility.GetSignedReliabilityMessageParts();

            result.IncomingSignatureParts.AddParts(signedReliabilityMessageParts);
            result.OutgoingSignatureParts.AddParts(signedReliabilityMessageParts);

            // From the Client to the Service
            ScopedMessagePartSpecification signaturePart  = result.IncomingSignatureParts;
            ScopedMessagePartSpecification encryptionPart = result.IncomingEncryptionParts;

            ProtectProtocolMessage(signaturePart, encryptionPart, MakeConnectionConstants.MakeConnectionMessage.Action);

            return(result);
        }
        EndpointAddress GetAddress()
        {
            EndpointAddress address = null;

            if (this.IsMakeConnectionPollingMessage)
            {
                MakeConnectionMessageInfo  info  = MakeConnectionMessageInfo.ReadMessage(this.RequestMessage);
                MakeConnectionMessageFault fault = VerifyProtocolElements(info);

                if (fault == null)
                {
                    address = new EndpointAddress(info.Address);
                }
                else
                {
                    this.isFaulting = true;
                    IAsyncResult result = BeginReply(fault.CreateMessage(RequestMessage.Version), onFaultCompleted, this);
                    if (result.CompletedSynchronously)
                    {
                        OnFaultCompletedCore(result);
                    }
                }
            }
            else
            {
                // normal message, grab the reply-to
                address = this.RequestMessage.Headers.ReplyTo;
            }

            if (address != null)
            {
                this.addressIsAnonymousUri = MakeConnectionUtility.IsAnonymousUri(address.Uri);
            }

            return(address);
        }
Exemplo n.º 4
0
 public void EnqueueException(Exception ex)
 {
     this.exceptionQueue.AddException(MakeConnectionUtility.WrapAsyncException(ex));
 }