Thursday, June 20, 2019

XML Logger - EAI Data Transformation Engine

If you are already capturing the XML payloads of a web service using the XML Logger, then extending it to further troubleshoot how you might have ended up with that payload might be useful since integration workflows frequently undergo multiple transformations. The existing logRequest and logResponse as invoked by the PreInvoke method of the 'XXX Utilities' business service are central to the actual logic.  What is needed now is to add logic to the 'EAI Data Transformation Engine' business service.  The PreInvoke needs the following script added:

function Service_PreInvokeMethod (MethodName, Inputs, Outputs){
  if (MethodName=="Execute") {
    TheApplication().Utility.InvokeMethod("logTransformRequest", Inputs, TheApplication().NewPropertySet());
  } 
  return (ContinueOperation);
}

The Invoke needs the following script added:

function Service_InvokeMethod (MethodName, Inputs, Outputs) {
  if (MethodName=="Execute") {
    TheApplication().Utility.InvokeMethod("logTransformResponse", Outputs, TheApplication().NewPropertySet());
  } 
}

The logRequest and logResponse methods set the direction attribute to 'EAI Transform' to distinguish it and uses the MapName attribute as the functional name.  The Record Id is assumed to be an element called 'Id' in the first top level container.

I made a personal decision that logging these payloads was not universally necessary and therefore wanted to make logging these records conditional.  In my case I made it run in two scenarios:
  • If the executing user's log level is 5 and payload logging is enabled
  • If the payload logging is not generally enabled but an error occurred subsequently in the executing workflow of a subprocess it called.

No comments:

Post a Comment