locked
Cusom soap faults from a pipeline component RRS feed

  • Question

  • If I throw an exception in a pipeline component, a WCF receive location will return a soap fault.  I have two additional requirements I need to satisfy.

    1. I need to return a fault string that does not include the internal exception details, which may contain sensitive information, but instead returns a friendly description.
    2. I need to return additional elements in the details of the fault:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:myerrr="mytest.com">
      <soapenv:Body>
        <soapenv:Fault>
          <faultcode>soapenv:Server</faultcode>
          <faultstring>Database Error</faultstring>
          <detail>
            <myerrr:SystemError>
              <myerrr:Type>Data</myerrr:Type>
              <myerrr:Message>Invalid Data</err:Message>
              <myerrr:Code>1234</myerrr:Code>
            </myerrr:SystemError>
          </detail>
        </soapenv:Fault>
      </soapenv:Body>
    </soapenv:Envelope>
    

    How can this be done?  I would need to reflect the fault schema in the wsdl, and somehow generate the fault from the pipeline component.

    Friday, November 14, 2014 10:34 PM

Answers

  • Then you can have a fault contract object defined as per soap exception that will contain all the required filed for exception object.

    You can find a good article here .

    http://adventuresinsidethemessagebox.wordpress.com/2013/12/01/throwing-typed-wcf-faults-back-to-consumers-in-a-biztalk-messaging-only-application-part-2-creating-the-typed-fault/

    • Marked as answer by Angie Xu Thursday, November 20, 2014 2:15 AM
    Tuesday, November 18, 2014 1:42 AM

All replies

  • Why not to use Fault Port with Solicit response which will be subscribed to SOAP Exception ?

    You can publish Orchestration as Service instead of schema as service so the fault contract will be available in WSDL.

    You can take reference from Seroter blog in mentioned in below Link

    handling-and-throwing-soap-exceptions-from-biztalk

    The only change you require here is to construct the soap exception message on SOAP Schema  (here Seroter has taken a string in the example )

    Thanks

    Abhishek

    Saturday, November 15, 2014 6:34 AM
  • Hi Jeremy,

    All you need to do is implement custom endpoint and service behaviors

    In this case, custom service behaviors can be used to add custom error handler that inspects the out of the box error that is being returned to the client and replaces the sensitive information with the custom error details.

    And custom endpoint behaviors is used to copy the SOAP action value from the request message to the response.  This is very important as the response message returned by BizTalk must hold the same SOAP action as the original request. This is generally added with your want to return a response/custom SOAP fault in response so that the response can be deliver to its corresponding request.

    Johann Cooper has an excellent blog port series where he explains this use case with code samples.

    Throwing typed WCF faults back to consumers in a BizTalk.

    Also read this blogpost from Paolo Salvatori where similar case has been detailed. Though this sample refers to fault exceptions from Orchestrations published as WCF services, this blog details how custom endpoint and service behaviors can be used to handle this case better

    How to Throw Typed Fault Exceptions from Orchestrations Published as WCF Services



    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

    Sunday, November 16, 2014 8:56 PM
  • Why not to use Fault Port with Solicit response which will be subscribed to SOAP Exception ?

    You can publish Orchestration as Service instead of schema as service so the fault contract will be available in WSDL.

    You can take reference from Seroter blog in mentioned in below Link

    handling-and-throwing-soap-exceptions-from-biztalk

    The only change you require here is to construct the soap exception message on SOAP Schema  (here Seroter has taken a string in the example )

    Thanks

    Abhishek

    I do not want an orchestration solution.  Aside from the soap fault, this is a solution that can be done easily with a pure messaging solution.
    Monday, November 17, 2014 9:19 PM
  • Then you can have a fault contract object defined as per soap exception that will contain all the required filed for exception object.

    You can find a good article here .

    http://adventuresinsidethemessagebox.wordpress.com/2013/12/01/throwing-typed-wcf-faults-back-to-consumers-in-a-biztalk-messaging-only-application-part-2-creating-the-typed-fault/

    • Marked as answer by Angie Xu Thursday, November 20, 2014 2:15 AM
    Tuesday, November 18, 2014 1:42 AM