private void ProcessCreateSequenceResponse(Message response, DateTime start) { CreateSequenceResponseInfo createSequenceResponseInfo = null; using (response) { if (response.IsFault) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmUtilities.CreateCSFaultException(base.Settings.MessageVersion, base.Settings.ReliableMessagingVersion, response, this.binder.Channel)); } WsrmMessageInfo info2 = WsrmMessageInfo.Get(base.Settings.MessageVersion, base.Settings.ReliableMessagingVersion, this.binder.Channel, this.binder.GetInnerSession(), response, true); if (info2.ParsingException != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ProtocolException(System.ServiceModel.SR.GetString("UnparsableCSResponse"), info2.ParsingException)); } base.ProcessInfo(info2, null, true); createSequenceResponseInfo = info2.CreateSequenceResponseInfo; string message = null; string faultReason = null; if (createSequenceResponseInfo == null) { message = System.ServiceModel.SR.GetString("InvalidWsrmResponseChannelNotOpened", new object[] { "CreateSequence", info2.Action, WsrmIndex.GetCreateSequenceResponseActionString(base.Settings.ReliableMessagingVersion) }); } else if (!object.Equals(createSequenceResponseInfo.RelatesTo, this.requestor.MessageId)) { message = System.ServiceModel.SR.GetString("WsrmMessageWithWrongRelatesToExceptionString", new object[] { "CreateSequence" }); faultReason = System.ServiceModel.SR.GetString("WsrmMessageWithWrongRelatesToFaultString", new object[] { "CreateSequence" }); } else if ((createSequenceResponseInfo.AcceptAcksTo == null) && (base.InputID != null)) { if (base.Settings.ReliableMessagingVersion != ReliableMessagingVersion.WSReliableMessagingFebruary2005) { if (base.Settings.ReliableMessagingVersion != ReliableMessagingVersion.WSReliableMessaging11) { throw Fx.AssertAndThrow("Reliable messaging version not supported."); } message = System.ServiceModel.SR.GetString("CSResponseOfferRejected"); faultReason = System.ServiceModel.SR.GetString("CSResponseOfferRejectedReason"); } else { message = System.ServiceModel.SR.GetString("CSResponseWithoutOffer"); faultReason = System.ServiceModel.SR.GetString("CSResponseWithoutOfferReason"); } } else if ((createSequenceResponseInfo.AcceptAcksTo != null) && (base.InputID == null)) { message = System.ServiceModel.SR.GetString("CSResponseWithOffer"); faultReason = System.ServiceModel.SR.GetString("CSResponseWithOfferReason"); } else if ((createSequenceResponseInfo.AcceptAcksTo != null) && (createSequenceResponseInfo.AcceptAcksTo.Uri != this.binder.RemoteAddress.Uri)) { message = System.ServiceModel.SR.GetString("AcksToMustBeSameAsRemoteAddress"); faultReason = System.ServiceModel.SR.GetString("AcksToMustBeSameAsRemoteAddressReason"); } if ((faultReason != null) && (createSequenceResponseInfo != null)) { WsrmFault fault = SequenceTerminatedFault.CreateProtocolFault(createSequenceResponseInfo.Identifier, faultReason, null); base.OnLocalFault(null, fault, null); } if (message != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ProtocolException(message)); } } base.InitiationTime = (TimeSpan)(DateTime.UtcNow - start); base.OutputID = createSequenceResponseInfo.Identifier; this.pollingTimer.Set(this.GetPollingInterval()); base.StartInactivityTimer(); }
void ProcessCreateSequenceResponse(Message response, DateTime start) { CreateSequenceResponseInfo createResponse = null; using (response) { if (response.IsFault) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmUtilities.CreateCSFaultException( this.Settings.MessageVersion, this.Settings.ReliableMessagingVersion, response, this.binder.Channel)); } else { WsrmMessageInfo info = WsrmMessageInfo.Get(this.Settings.MessageVersion, this.Settings.ReliableMessagingVersion, this.binder.Channel, this.binder.GetInnerSession(), response, true); if (info.ParsingException != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ProtocolException(SR.GetString(SR.UnparsableCSResponse), info.ParsingException)); } // this throws and sends a fault if something is wrong with the info this.ProcessInfo(info, null, true); createResponse = info.CreateSequenceResponseInfo; string exceptionReason = null; string faultReason = null; if (createResponse == null) { exceptionReason = SR.GetString(SR.InvalidWsrmResponseChannelNotOpened, WsrmFeb2005Strings.CreateSequence, info.Action, WsrmIndex.GetCreateSequenceResponseActionString(this.Settings.ReliableMessagingVersion)); } else if (!object.Equals(createResponse.RelatesTo, this.requestor.MessageId)) { exceptionReason = SR.GetString(SR.WsrmMessageWithWrongRelatesToExceptionString, WsrmFeb2005Strings.CreateSequence); faultReason = SR.GetString(SR.WsrmMessageWithWrongRelatesToFaultString, WsrmFeb2005Strings.CreateSequence); } else if ((createResponse.AcceptAcksTo == null) && (this.InputID != null)) { if (this.Settings.ReliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005) { exceptionReason = SR.GetString(SR.CSResponseWithoutOffer); faultReason = SR.GetString(SR.CSResponseWithoutOfferReason); } else if (this.Settings.ReliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) { exceptionReason = SR.GetString(SR.CSResponseOfferRejected); faultReason = SR.GetString(SR.CSResponseOfferRejectedReason); } else { throw Fx.AssertAndThrow("Reliable messaging version not supported."); } } else if ((createResponse.AcceptAcksTo != null) && (this.InputID == null)) { exceptionReason = SR.GetString(SR.CSResponseWithOffer); faultReason = SR.GetString(SR.CSResponseWithOfferReason); } else if (createResponse.AcceptAcksTo != null && (createResponse.AcceptAcksTo.Uri != this.binder.RemoteAddress.Uri)) { exceptionReason = SR.GetString(SR.AcksToMustBeSameAsRemoteAddress); faultReason = SR.GetString(SR.AcksToMustBeSameAsRemoteAddressReason); } if ((faultReason != null) && (createResponse != null)) { UniqueId sequenceId = createResponse.Identifier; WsrmFault fault = SequenceTerminatedFault.CreateProtocolFault(sequenceId, faultReason, null); this.OnLocalFault(null, fault, null); } if (exceptionReason != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ProtocolException(exceptionReason)); } } } this.InitiationTime = DateTime.UtcNow - start; this.OutputID = createResponse.Identifier; this.pollingTimer.Set(this.GetPollingInterval()); base.StartInactivityTimer(); }