Topic
  • 3 replies
  • Latest Post - ‏2012-03-21T13:19:47Z by SystemAdmin
kelleyr
kelleyr
3 Posts

Pinned topic B2B Gateway XML error capture

‏2012-03-20T00:56:14Z |
I need to capture XML validation errors in the B2B Gateway, so I can reformat the error message response sent to the sender. I added a validation action and on-error action to the Partner Profile Processing Policy. This works for validating content in the XML elements, but when I send invalid XML (for example, mismatching tags), the error is captured earlier in the B2B Gateway, and never gets to my processing policy. So I get the standard DataPower error response message. Is there a way to capture these XML structure errors, so I can send my own response message?
Here is an example of the mismatch error I'm getting:

b2bgw (Myhub): Error parsing EDI content of xml message (Content-Type: application/soap+xml;charset=UTF-8;action="RealTimeTransaction") : mismatched tag, expected ns1:COREEnvelopeRealTimeRequest at offset 275 of http://192.168.1.170:3098/
Updated on 2012-03-21T13:19:47Z at 2012-03-21T13:19:47Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: B2B Gateway XML error capture

    ‏2012-03-20T07:58:25Z  
    B2B Gateway will try to parse the xml doc to retrieve the partner id, so that it know which partner profile to use and what processing policy to run. As a result, this happened before running the processing policy.

    I think there are two ways to address the issue you faced:

    1) Add a MGPW in front of B2B Gateway to valid the xml first. You could also generate error response in MPGW. If XML is valid, MPGW then forward the XML to B2B GW for further processing.

    2) Using Document Routing Preprocessor to set the doc-type as binary and specify the "from" and "to" partner using service variables. This way B2B Gateway will skip the pre-processing step so that you can do the validation in your stylesheet. You can find a good example of how to specify doc type and partner id in the default routing stylesheet ( b2b-routing.xsl). Note that the Document Routing Preprocessor only works when the front side protocol handler is not AS or ebMS.
  • kelleyr
    kelleyr
    3 Posts

    Re: B2B Gateway XML error capture

    ‏2012-03-20T17:45:14Z  
    B2B Gateway will try to parse the xml doc to retrieve the partner id, so that it know which partner profile to use and what processing policy to run. As a result, this happened before running the processing policy.

    I think there are two ways to address the issue you faced:

    1) Add a MGPW in front of B2B Gateway to valid the xml first. You could also generate error response in MPGW. If XML is valid, MPGW then forward the XML to B2B GW for further processing.

    2) Using Document Routing Preprocessor to set the doc-type as binary and specify the "from" and "to" partner using service variables. This way B2B Gateway will skip the pre-processing step so that you can do the validation in your stylesheet. You can find a good example of how to specify doc type and partner id in the default routing stylesheet ( b2b-routing.xsl). Note that the Document Routing Preprocessor only works when the front side protocol handler is not AS or ebMS.
    Thanks for the quick reply!

    Unfortunately, our FSH is AS2. My understanding is that we need the B2B Gateway for AS2, so the MPGW in front of the B2B Gateway is not an option. When you say that "Document Routing Preprocessor only works when the front side protocol handler is not AS", does that include AS2?
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: B2B Gateway XML error capture

    ‏2012-03-21T13:19:47Z  
    • kelleyr
    • ‏2012-03-20T17:45:14Z
    Thanks for the quick reply!

    Unfortunately, our FSH is AS2. My understanding is that we need the B2B Gateway for AS2, so the MPGW in front of the B2B Gateway is not an option. When you say that "Document Routing Preprocessor only works when the front side protocol handler is not AS", does that include AS2?
    Yeah, AS protocol includes AS1/AS2/AS3. The document routing preprocessor won't work for AS protocols.

    In fact, AS2 is basically a HTTP based protocol, so you can setup MPGW with HTTP front side protocol handler to receive the transaction, perform xml validation, then forward to backend B2BGW using http protocol. In the response flow, MPGW just pass thru everything returned from B2B Gateway.