protected override IAsyncResult BeginSendResolveResponse(
     IDiscoveryResponseContract11 responseChannel,
     DiscoveryMessageSequence discoveryMessageSequence,
     EndpointDiscoveryMetadata matchingEndpoint,
     AsyncCallback callback,
     object state)
 {
     return(responseChannel.BeginResolveMatchOperation(
                ResolveMatchesMessage11.Create(
                    discoveryMessageSequence,
                    matchingEndpoint),
                callback,
                state));
 }
        public void EndResolveOperation(IAsyncResult result)
        {
            ResolveMatchesMessage11 response = base.Channel.EndResolveOperation(result);
            AsyncOperationContext   context  = (AsyncOperationContext)result.AsyncState;

            if ((response != null) && (response.ResolveMatches != null) && (response.ResolveMatches.ResolveMatch != null))
            {
                this.responseReceiver.ResolveMatchOperation(
                    context.OperationId,
                    DiscoveryUtility.ToDiscoveryMessageSequenceOrNull(response.MessageSequence),
                    response.ResolveMatches.ResolveMatch.ToEndpointDiscoveryMetadata());
            }
            else
            {
                this.responseReceiver.PostResolveCompletedAndRemove(context.OperationId, false, null);
            }
        }
        public void ResolveOperation(ResolveCriteria resolveCriteria)
        {
            ResolveMessage11 request = new ResolveMessage11();

            request.Resolve = ResolveCriteria11.FromResolveCriteria(resolveCriteria);

            ResolveMatchesMessage11 response = base.Channel.ResolveOperation(request);

            if ((response != null) && (response.ResolveMatches != null) && (response.ResolveMatches.ResolveMatch != null))
            {
                this.responseReceiver.ResolveMatchOperation(
                    OperationContext.Current.IncomingMessageHeaders.RelatesTo,
                    DiscoveryUtility.ToDiscoveryMessageSequenceOrNull(response.MessageSequence),
                    response.ResolveMatches.ResolveMatch.ToEndpointDiscoveryMetadata());
            }
            else
            {
                this.responseReceiver.PostResolveCompletedAndRemove(OperationContext.Current.IncomingMessageHeaders.RelatesTo, false, null);
            }
        }
        public IAsyncResult BeginResolveMatchOperation(ResolveMatchesMessage11 response, AsyncCallback callback, object state)
        {
            Fx.Assert(response != null, "The response message cannot be null.");
            if ((response.MessageSequence != null) && (response.ResolveMatches != null) && (response.ResolveMatches.ResolveMatch != null))
            {
                this.responseReceiver.ResolveMatchOperation(
                    OperationContext.Current.IncomingMessageHeaders.RelatesTo,
                    response.MessageSequence.ToDiscoveryMessageSequence(),
                    response.ResolveMatches.ResolveMatch.ToEndpointDiscoveryMetadata());
            }
            else
            {
                if (TD.DiscoveryMessageWithNullMessageSequenceIsEnabled() && response.MessageSequence == null)
                {
                    TD.DiscoveryMessageWithNullMessageSequence(
                        ProtocolStrings.TracingStrings.ResolveMatches,
                        OperationContext.Current.IncomingMessageHeaders.MessageId.ToString());
                }
            }

            return(new CompletedAsyncResult(callback, state));
        }