none
Exception handling while using WCF-SQL Adapter RRS feed

  • Question

  • Hi all,

    While doing transformations from Excel or Flat file to EDI, i had made use of "Microsoft.XLANGs.BaseTypes.DeliveryFailureException" in the exception block of Orchestration and used to save these to a dedicated "Faults" folder.

    Now, while doing transformations from Excel or Flat file to SQL, using WCF-SQL adapter, I am not able to achieve the same.

    I am referring the below links,

    http://www.codeproject.com/Articles/13576/A-developers-guide-to-handling-exceptions-in-BizTa

    http://kentweare.blogspot.co.uk/2007/11/biztalk-delivery-notification.html

    https://social.msdn.microsoft.com/Forums/en-US/66abdc3a-82a0-419f-acf6-c5c0d506d4f4/catch-sql-server-send-port-one-way-wcfsql-exception-in-orchestration?forum=biztalkr2adapters

    https://connectedcircuits.wordpress.com/2014/01/17/handling-sql-errors-in-try-catch-blocks-using-the-wcf-sql-adaptor/

    But, still am not able to achieve success. Please let me know the best steps to achieve this.

    Thanks in Advance,


    Anand

    Friday, January 30, 2015 2:03 PM

Answers

  • I have for sure used sqlBinding, oracleDBBinding, webHttpBinding with One-Way Send Ports, always with the WCF-Custom Adapter.

    It works perfectly fine when you don't care about the response content.  For http, anything other then 2xx will still raise an error.

    My assumption, never looked because it never mattered, is the bridge adapter (WCF-Custom) just ignores the binding's response.  The bindings themselves are still essentially Two-Way.

    The Wizard will always make Two-Way Binding Files so you do have to modify them to create One-Way Ports.


    Friday, January 30, 2015 5:45 PM
    Moderator
  • Hi,

    Once you catch the exception and route the exception message to a folder you can then add Terminate Shape or Suspend shape so that control doesn't goes further after exception.

    Refer the links below:

    Delivery Notification demystified

    http://johnnystechnicallife.blogspot.in/2012/08/must-receive-before-sending-fault.html

    BizTalk - Biztalk Delivery Notification=True

    How to Configure the Terminate Shape

    Using the Suspend Shape

    I think you have already set IncludeExceptionDetailInFaults = true option. This error is thrown back my database, as per my understand there is no way you can get the line number or the fault value where the exception has occurred. You are getting the field/parameter name and I think it should suffice, specify if otherwise. 

    Rachit


    Please mark as answer or vote as helpful if my reply does






    Sunday, February 1, 2015 5:13 PM
    Moderator

All replies

  • BizTalk delivery notifications (i.e. Microsoft.XLANGs.BaseTypes.DeliveryFailureException) do not work with request-response ports. They only work with one-way ports (where a negative acknowledgments triggers the DeliveryFailureException). And since WCF send adapters do not support one-way WCF operations, then WCF ports must be request-response and thus they do not support delivery failure notifications.

    When you have WCF-SQL adapter with solicit-response (two-way) port, you don’t need to worry much. When you send the request to execute the insert, if it works you will get response otherwise you will not get any response. So when you don’t get the response, handle it in exception handler.

    Refer Ashwin's suggestion here-> WCF-SQL exception handling In orchestration

    Also BizTalk – WCF Exception Handling Scenarios 

    Rachit


    Please mark as answer or vote as helpful if my reply does


    Friday, January 30, 2015 2:20 PM
    Moderator
  • And since WCF send adapters do not support one-way WCF operations, then WCF ports must be request-response and thus they do not support delivery failure notifications.


    Are you sure about this?  I use One-Way WCF Ports all the time.  Delivery Notifications is a feature of the Messaging Engine and is not Adapter specific.
    Friday, January 30, 2015 2:41 PM
    Moderator
  • John correct me if I am wrong.

    My understanding was the WCF Adapter cannot handle one-way contracts easily. You need to write a custom binding element which only supports one-way channels and for this we need to use the WCF-Custom adapter, since that is the only adapter which allows you to add behaviors or configure the customBinding binding with user-specified binding elements.

    Rachit



    Please mark as answer or vote as helpful if my reply does

    Friday, January 30, 2015 3:02 PM
    Moderator
  • I have for sure used sqlBinding, oracleDBBinding, webHttpBinding with One-Way Send Ports, always with the WCF-Custom Adapter.

    It works perfectly fine when you don't care about the response content.  For http, anything other then 2xx will still raise an error.

    My assumption, never looked because it never mattered, is the bridge adapter (WCF-Custom) just ignores the binding's response.  The bindings themselves are still essentially Two-Way.

    The Wizard will always make Two-Way Binding Files so you do have to modify them to create One-Way Ports.


    Friday, January 30, 2015 5:45 PM
    Moderator
  • Hi All,

    Thanks for your inputs. I was able to catch the Delivery Notification Exception and route it to some Faults folder.

    Also, can you please help me with useful links on terminating/suspending the orchestration instance as soon as I get any error.

    1 more thing is,  I am getting the custom message in the Faults Folder like the below:

    <?xml version="1.0"?>
    <string>An error occurred while processing the message, refer to the details section for more information 
    Message ID: {1002C8A9-689D-4538-B8D8-CC98C8036E94}
    Instance ID: {83A0A779-9467-4127-B212-03A6F9EE4AD4}
    Error Description: Microsoft.ServiceModel.Channels.Common.XmlReaderParsingException: The input data for the field/parameter "Parameter1" is larger than that allowed on the SQL Server. Maximum length allowed is 50, length found was 263.

    Is there any easy way so that along with the message above, showing the line number or the fault value. (As there will be thousands of records in the input excel file)

    Thanks in Advance,


    Anand

    Sunday, February 1, 2015 12:14 PM
  • Hi,

    Once you catch the exception and route the exception message to a folder you can then add Terminate Shape or Suspend shape so that control doesn't goes further after exception.

    Refer the links below:

    Delivery Notification demystified

    http://johnnystechnicallife.blogspot.in/2012/08/must-receive-before-sending-fault.html

    BizTalk - Biztalk Delivery Notification=True

    How to Configure the Terminate Shape

    Using the Suspend Shape

    I think you have already set IncludeExceptionDetailInFaults = true option. This error is thrown back my database, as per my understand there is no way you can get the line number or the fault value where the exception has occurred. You are getting the field/parameter name and I think it should suffice, specify if otherwise. 

    Rachit


    Please mark as answer or vote as helpful if my reply does






    Sunday, February 1, 2015 5:13 PM
    Moderator
  • Also, can you please help me with useful links on terminating/suspending the orchestration instance as soon as I get any error.


    In Orchestration designer you have suspend and terminate shape :) but why you want to use this it would be better choice to gracefully capture exception and publish it the Exception Orchestration or any Exception database .

    Now coming to second part  you can capture the exception details from the Exception object which is being generated .

    Hope this answer your question

    Thanks

    Abhishek

    Monday, February 2, 2015 5:45 AM