Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / TransactionBridge / Microsoft / Transactions / Wsat / Messaging / MessageDispatch.cs / 1 / MessageDispatch.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- // Implement generic reception of datagram and request messages using System; using System.ServiceModel.Channels; using System.Diagnostics; using System.ServiceModel; using Microsoft.Transactions.Wsat.Protocol; using DiagnosticUtility = Microsoft.Transactions.Bridge.DiagnosticUtility; namespace Microsoft.Transactions.Wsat.Messaging { abstract class DatagramMessageDispatcher { ProtocolVersion protocolVersion; protected DatagramMessageDispatcher(ProtocolVersion protocolVersion) { this.protocolVersion = protocolVersion; } protected abstract DatagramProxy CreateFaultProxy(EndpointAddress to); protected void OnMessageException(Message message, CommunicationException exception) { DebugTrace.Trace ( TraceLevel.Warning, "{0} - {1} reading datagram with action {2}: {3}", this.GetType().Name, exception.GetType().Name, message.Headers.Action, exception.Message); EndpointAddress sendTo = Library.GetFaultToHeader(message.Headers, this.protocolVersion); if (sendTo == null) { DebugTrace.Trace ( TraceLevel.Warning, "Ignoring invalid datagram - a fault-to header could not be obtained" ); } else { DatagramProxy proxy = null; try { proxy = CreateFaultProxy(sendTo); } catch (CreateChannelFailureException e) { DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning); DebugTrace.Trace (TraceLevel.Warning, "Ignoring invalid datagram: {0}", e.Message); } if (proxy != null) { try { IAsyncResult ar = proxy.BeginSendFault (message.Headers.MessageId, Faults.Version(this.protocolVersion).InvalidParameters, null, null); proxy.EndSendMessage (ar); if (DebugTrace.Warning) { DebugTrace.Trace ( TraceLevel.Warning, "Sent InvalidParameters fault to {0}", proxy.To.Uri ); } } catch (WsatSendFailureException e) { DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning); if (DebugTrace.Warning) { DebugTrace.Trace ( TraceLevel.Warning, "{0} sending InvalidParameters fault to {1}: {2}", e.GetType().Name, proxy.To.Uri, e.Message); } } finally { proxy.Release(); } } } } } abstract class RequestMessageDispatcher { protected abstract void SendFaultReply (RequestAsyncResult result, Fault fault); protected void OnMessageException (RequestAsyncResult result, Message message, CommunicationException exception, Fault fault) { DebugTrace.Trace ( TraceLevel.Warning, "{0} - {1} reading request with action {2}: {3}", this.GetType().Name, exception.GetType().Name, message.Headers.Action, exception.Message); SendFaultReply (result, fault); DebugTrace.Trace (TraceLevel.Warning, "Replied with {0} fault", fault.Code.Name); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CachedFontFamily.cs
- CollectionTypeElement.cs
- SoapCommonClasses.cs
- CreateUserWizardAutoFormat.cs
- RoutedEventArgs.cs
- _ConnectStream.cs
- BoolLiteral.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- CodePageUtils.cs
- ResourcePart.cs
- DataGridViewCellValidatingEventArgs.cs
- UriSection.cs
- SecurityProtocolCorrelationState.cs
- ReflectionTypeLoadException.cs
- SortKey.cs
- BufferedGenericXmlSecurityToken.cs
- Select.cs
- DesignerAutoFormatStyle.cs
- EmbeddedMailObject.cs
- StringUtil.cs
- EntityViewGenerator.cs
- Animatable.cs
- ToolBar.cs
- LookupBindingPropertiesAttribute.cs
- XmlBinaryReader.cs
- DynamicRendererThreadManager.cs
- SafeCoTaskMem.cs
- CompositeControl.cs
- PolyBezierSegment.cs
- LineBreak.cs
- StrokeDescriptor.cs
- BamlResourceSerializer.cs
- TakeQueryOptionExpression.cs
- CollectionBase.cs
- ListViewItem.cs
- BitmapEffectInputData.cs
- TrackingLocation.cs
- UniqueIdentifierService.cs
- SymbolType.cs
- ActivityBuilder.cs
- TextEditorCopyPaste.cs
- WinFormsSecurity.cs
- ClickablePoint.cs
- HostingPreferredMapPath.cs
- WebPartMenu.cs
- WebScriptEndpointElement.cs
- NamespaceInfo.cs
- NavigationProperty.cs
- ResourceAssociationSet.cs
- DataGridToolTip.cs
- MediaTimeline.cs
- serverconfig.cs
- DataGridViewCellStateChangedEventArgs.cs
- XmlSignatureManifest.cs
- BuildProviderCollection.cs
- Variant.cs
- DeferredTextReference.cs
- DataKeyArray.cs
- SchemaImporterExtension.cs
- TcpHostedTransportConfiguration.cs
- TextReader.cs
- Stackframe.cs
- ToolStripSeparator.cs
- WindowsFormsEditorServiceHelper.cs
- PipelineModuleStepContainer.cs
- UnitySerializationHolder.cs
- HtmlInputCheckBox.cs
- LineServicesRun.cs
- TextElementEnumerator.cs
- SqlUdtInfo.cs
- WebBrowserNavigatedEventHandler.cs
- glyphs.cs
- BaseParagraph.cs
- ScalarType.cs
- AutomationProperties.cs
- TypeNameConverter.cs
- ScalarConstant.cs
- ADConnectionHelper.cs
- ResourcePermissionBaseEntry.cs
- XmlParserContext.cs
- XMLSchema.cs
- WebResourceUtil.cs
- EventPrivateKey.cs
- CurrencyWrapper.cs
- BeginStoryboard.cs
- TimeSpan.cs
- BaseInfoTable.cs
- HtmlMeta.cs
- CodePropertyReferenceExpression.cs
- DockingAttribute.cs
- OpacityConverter.cs
- RtType.cs
- COM2ComponentEditor.cs
- DataExchangeServiceBinder.cs
- ADMembershipProvider.cs
- DetailsView.cs
- ConvertBinder.cs
- DataGridViewCell.cs
- SynchronizedInputProviderWrapper.cs
- Boolean.cs