none
Unable to create a fault message using Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage() RRS feed

  • Question

  • Hello Friends,

    I am unable to create a fault message using Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage() method in exception handler in Orchestration.

    I have a stored procedure that raises an error when there is a business validation error and BizTalk catches the exception and creates fault ESB messages. This was working fine with SQL adapter. I have recently upgraded SQL adapter to WCF-SQL adapter and noticed this issue. By looking at the error, it looks like the CreateFaultMessage() is unable to parse the exception message as it has ampersand (special character). 

    Here is WCF-SQL error on the send port:

    A message sent to adapter "WCF-Custom" on send port "ShopInfoDetails_WCFSQL" with URI "mssql://XXXX/XXXX/abc?" is suspended. 
     Error details: System.Data.SqlClient.SqlException (0x80131904): PER_DIEM: Specified Car Initial and Car Number belongs to Per Diem Contract

    Server stack trace: 
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)

    Exception rethrown at [0]: 
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)
    ClientConnectionId:cc6d0574-75ff-4c09-88f8-f07cc2a41b64
    Error Number:50000,State:1,Class:11 
     MessageId:  {8CE6E466-3E0D-407E-8D92-E35A57E7DAAB}
     InstanceID: {11396CFB-04B6-4690-B16D-2447FFEA5691}

    Here is CreateFaultMessage() exception error:

    xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'Orchestration_Inbound(e737439a-e317-6d69-7d83-fa90f350f593)'.
    The service instance will remain suspended until administratively resumed or terminated. 
    If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
    InstanceId: 2d8e54de-11d6-45d1-8df0-9ecd9f2ff579
    Shape name: Assign_FaultMessage_OutGoing
    ShapeId: 909b6019-6eed-463d-858f-ef18c2ee95e8
    Exception thrown from: segment 11, progress 6
    Inner exception: An unexpected error occurred while attempting to create the ESB Fault Message.
            
    Exception type: CreateFaultMessageException
    Source: Microsoft.Practices.ESB.ExceptionHandling
    Target Site: Microsoft.XLANGs.BaseTypes.XLANGMessage CreateFaultMessage()
    The following is a stack trace that identifies the location where the exception occured

       at Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage()
       at Orchestration_Inbound.segment11(StopConditions stopOn)
       at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
    Additional error information:

            An error occurred while parsing EntityName. Line 14, position 75.
            
    Exception type: XmlException
    Source: System.Xml
    Target Site: Void Throw(System.Exception)
    The following is a stack trace that identifies the location where the exception occured

       at System.Xml.XmlTextReaderImpl.Throw(Exception e)
       at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
       at System.Xml.XmlTextReaderImpl.ParseEntityName()
       at System.Xml.XmlTextReaderImpl.ParseEntityReference()
       at System.Xml.XmlTextReaderImpl.Read()
       at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
       at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
       at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
       at System.Xml.XmlDocument.Load(XmlReader reader)
       at System.Xml.XmlDocument.LoadXml(String xml)
       at Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage()

    Can you please help me regarding this issue?

    Wednesday, May 1, 2019 6:50 PM

Answers

  • There is only one way I would address: Don't use the ESB Toolkit.

    All you need to do is log the error to the Windows Event Log.

    In this case especially, ESBT is only adding a lot of unnecessary complexity for no practical benefit, meaning it's a significant net negative.

    If someone is making you do this, just let us know their reasons and we can help you explain why they're...mis-guided.

    • Marked as answer by KuldeepV Wednesday, May 8, 2019 7:23 PM
    Thursday, May 2, 2019 6:53 PM

All replies

  • There is only one way I would address: Don't use the ESB Toolkit.

    All you need to do is log the error to the Windows Event Log.

    In this case especially, ESBT is only adding a lot of unnecessary complexity for no practical benefit, meaning it's a significant net negative.

    If someone is making you do this, just let us know their reasons and we can help you explain why they're...mis-guided.

    • Marked as answer by KuldeepV Wednesday, May 8, 2019 7:23 PM
    Thursday, May 2, 2019 6:53 PM
  • Thanks John for the suggestion. Now, I don't use ESBT in my project.
    • Marked as answer by KuldeepV Wednesday, May 8, 2019 7:23 PM
    • Unmarked as answer by KuldeepV Wednesday, May 8, 2019 7:23 PM
    Wednesday, May 8, 2019 7:22 PM