Elton Stoneman

  Home  |   Contact  |   Syndication    |   Login
  120 Posts | 0 Stories | 3598 Comments | 0 Trackbacks

News

Archives

Post Categories

[Source: http://geekswithblogs.net/EltonStoneman]

The management portal for ESB Guidance is an excellent tool which displays information on faults generated during the processing of messages through the ESB. It also exposes Web and WCF services for logging your own faults to the exception database, so you can record exceptions that occur in your own service providers and use the portal as a single view over the health of your SOA stack.

The SubmitFault method of the ExceptionManagement service takes a FaultMessage object which must be correctly configured with Header and FaultException properties. It takes some trial-and-error to work out what needs populating – if any properties are missing or invalid, your fault won't be logged. I've put together a sample error handler on MSDN Code Gallery which populates a call correctly: ESB Guidance Error Handler, which you can use as-is in your WCF services, or as a basis for your own handler.

In the sample, the error handler is available to your service so you can manually log a fault for any exceptions that you catch, and you can also configure it as a service behaviour so it will log any uncaught exceptions in your WCF service. A sample service and client are provided for demonstration – set up the SampleService as a virtual directory and run SampleClient (you'll need the ESB Guidance Exception Management installed).

To use the ServiceProviderErrorHandler add a config section in your web.config to specify how faults are logged:

    <configSections>

    <section

name="serviceProviderErrorHandlerConfiguration"

type="ESBGuidanceErrorHandler.Configuration.ServiceProviderErrorHandlerConfiguration, ESBGuidanceErrorHandler"/>

    </configSections>

    <serviceProviderErrorHandlerConfiguration

exceptionHandlingUrl="http://localhost/ESB.ExceptionHandlingServices/ExceptionHandling.asmx"

bizTalkApplication="BizTalk Application 1"

faultCode="50054"

errorType="Service Provider exception"

failureCategory="0"

faultGeneratorName="ESBGuidanceErrorHandler">

    </serviceProviderErrorHandlerConfiguration>

This identifies the location of the ExceptionHandling service (the sample uses the SOAP entry point, but it's a simple change to use the WCF version as they have the same signature) and the descriptive text to categorise errors being logged, which will be shown in the portal. Note that the specified BizTalk Application must exist and the fault generator name is limited to 50 characters. Other values can contain any identifiers you like.

With the config specified, it's a simple call to log a fault – passing the name of the service provider and the service, description and severity of the fault, and an exception:

ServiceProviderErrorHandler.SubmitFault("ErroringService", "LogHandledException", "Caught exception", FaultSeverity.Error, ex);

To register the ServiceProviderErrorHandler to catch any unhandled exceptions that occur just requires a behaviour extension in the WCF service configuration:

    <system.serviceModel>

        <services>

            <service name="ErroringService" behaviorConfiguration="defaultServiceBehavior">

                <endpoint contract="IErroringService" binding="basicHttpBinding"/>

            </service>

        </services>

        <behaviors>

            <serviceBehaviors>

                <behavior name="defaultServiceBehavior">

                    <serviceMetadata httpGetEnabled="true"/>

                    <serviceDebug includeExceptionDetailInFaults="true"/>

                    <serviceProviderBehavior/>

                </behavior>

            </serviceBehaviors>

        </behaviors>

        <extensions>

            <behaviorExtensions>

                <add name="serviceProviderBehavior" type="ESBGuidanceErrorHandler.Behaviors.ServiceProviderBehavior, ESBGuidanceErrorHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=de4c0bb04730ca55"/>

            </behaviorExtensions>

        </extensions>

    </system.serviceModel>

Add this to all your WCF service providers and any exceptions will be logged and can be shown, filtered and subscribed to in the normal way.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted on Tuesday, January 20, 2009 8:43 AM

Feedback

# USANA 4/10/2010 7:20 AM skin-care
Great post containing some creative ideas.Thanks for posting.Keep it up

# re: Generic WCF Error Handler for ESB Guidance 9/28/2010 7:14 AM ipad scrapbook app
This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article.

# re: Generic WCF Error Handler for ESB Guidance 12/11/2010 6:08 AM St Pierre Koscheck Fight Video
Really impressed! Everything is very open and very clear explanation of issues. It contains truly information. Your website is very useful. Thanks for sharing. Looking forward to more!


# re: Generic WCF Error Handler for ESB Guidance 1/14/2011 3:25 AM well
Do you have a documentation on these?This is a good source.It seems it doesn't work for us.

# re: Generic WCF Error Handler for ESB Guidance 3/12/2011 7:38 AM florist France

This is a great blog with excellent posts and links.
Thanks for sharing.


# re: Generic WCF Error Handler for ESB Guidance 5/14/2011 12:02 AM pet sitting charlotte nc
having it large there

# re: Generic WCF Error Handler for ESB Guidance 5/14/2011 12:03 AM celebrity news today
great help this was

# re: Generic WCF Error Handler for ESB Guidance 5/19/2011 4:27 AM online high school classes
Trial and error can be minimized by using your formula. This formula will be very helpful for newbies like me.

# re: Generic WCF Error Handler for ESB Guidance 6/5/2011 12:09 AM London Escorts
This is a good post and with this “worldwide web” it will reach all corners of earth in seconds, technological advancements are making this world a much smaller place :-) Indian escorts

# re: Generic WCF Error Handler for ESB Guidance 6/16/2011 9:45 AM Newhand
We are a group of independents opening a new scheme in our community, you have done a good job here giving us a whole new way of looking at certain issues, great topic ice machine

# re: Generic WCF Error Handler for ESB Guidance 6/23/2011 7:00 AM tax accounting
Your article is very useful to me. With relevant evidence you provide the more makes me confident.


Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: