AnsweredAssumed Answered

Matching process for large XML payloads with most tags being optional

Question asked by BobBrundrett62351981 on Oct 11, 2017
Latest reply on Oct 11, 2017 by gadpr08

I'm manually creating an MQ-based virtual service for simulating field service calls.

Our XML requests have a handful of tags that are required for matching the request to response (primarily WorkRequestType and MeterType) and upwards of 50-75 additional fields. In trying to build these images, I'm running into difficulties using Signature matching, as some arbitrary customer data lines include "AddressLine2" or "DoingBusinessAs", as well as a variety of other optional data fields. 


Ultimately, I want to be able to include ALL possible fields, and if they exist in the actual request, great. If they don't, also great, since I only need a handful of fields to match on.  What I don't want to do is create a separate request for each variant.  If there are 5 commonly variant tags, I'd have to create 2^5 = 32 variants for each of the 6 work order types.


I'm trying to use a match script, but I'm not sure the logic is being called correctly. If I recall correctly, the match script should override the default matching logic (exact, signature, operation), correct? 


My beanshell match script:

boolean operationsMatch = incomingRequest.getOperation().equals(sourceRequest.getOperation());

if (operationsMatch) {
String requestWRT = incomingRequest.getArguments().get("OrderData_WorkReqTypeCode");
String requestMeterMfg = sourceRequest.getArguments().get("ServiceData_Meter_MeterManufacturer");

if(requestWRT.equals("CONNECT METER") && requestMeterMfg.equals("ITR")) {
// true means these arguments match
return true;
// false means no match
return false;

All the different work orders have the same Operation: "OpsWorkRequest"


Is there anything else I should be looking for?


Apologies in advance for vagueness, it's been a long day.


Thanks for any help!