TN -- Exception Handling issue

Good Morning/Evening.

I am in a situation where – Client will post (HTTP) XML data to TN. Now, from TN, I will be invoking wM Developer flow service to do some back-end job; and in the same session, i will reply back to sender.

Now, I need to validate the incoming XML data – whetehr that is in proper XML format or not. If the XML is not in proper format (Invalid XML or Doesn’t match with document-type), I need to send the exact error back in the response.

In case the wel-formed XML (which does not match the document type) gets posted; I can bypass it to developer flow by not validating the structure in TN. In developer flow, I am constructing the response msg and sending it back to TN as response.

But in case, the XML is not wel-formed; I am unable to pass it to developer as it is failing in TN itself and is getting ignored. How do I catch this error and process it. Can anybody please help me?

There are a few things you’ll want to consider for the configuration.

  • Be sure TN is able to recognize the document type. The safest bet is usually configuring the TN doc type with the root tag of the XML. If this isn’t reasonable, then you’ll need to consider if the doc type identification will still work given the types of document content mismatches you believe you may receive.

  • Configure the processing rules such that documents with errors get selected by the appropriate rule. Keep in mind that TN doesn’t care if the document doesn’t validate (though it must be well-formed)–if the doc matches a rule, that rule will be selected and its corresponding action (such as service invocation) will be taken.

  • For malformed XML, TN will return an error to the caller. I recommend that you do not have the client post directly to wm.tn:receive but instead post to an entry service the you write which invokes TN. This way you have more control over error handling and such. Refer to Improving Upon wm.tn:receive for the items you’ll want to address.

Hi Thanks again for you reply. This is really a great forum. Got valuable inputs.

But I would like to know – that as per your 3rd point, if I let client post directly to wm.tn:receive, and if client posts malformed XML data, I won’t have any chance to catch the error.

am I right?

Thanks.

That is correct. The error will be sent directly to the client for them to handle. And they need to handle errors anyway, whether from receive or from your entry service. On error, they should resend.