Automating csv imports into webMethods Business Rules

Hi, what are some ways I can automate the process of importing a csv into my Decision Table on webMethods Rules development, through scripting or maybe jenkins? I intend to use this automation in my CICD pipeline, where we’ll check in empty tables and have the automation import the appropriate data for the environment (1 csv for dev env, another one for prod) after the deployment completes.

Hi,

which version of wM Business Rules are we talking about?
Are there any Fixes applied to IS, MWS, RulesEngine?

I am not sure if the RulesEngine was designed for this type of request (dnyamically reloading the content of decision tables from CSV during deployment).

Regards,
Holger

Hi,

while webMethods Business Rules offers a CSV Import functionality (see documentation), this is only available via a button in the Business Rules web UI.

Potentially, you could create a “dev” and “prod” version of your decision tables and CSV Import the different data via the UI - but this wouldn’t be very automation-friendly.

regards,
Joerg

1 Like

Thank you for taking the time to reply. I’m running MWS 10.15.

Is there a way to programmatically invoke that import CSV button on MWS? I was trying to inspect the HTTP call onclick but it doesn’t seem very automation friendly.

Hi Vedus,

in this case you might want to check the webMethods Business Rules Reference Guide (already referenced by Joerg).

There are some REST services available on MWS which might be helpful in your case.

Regards,
Holger

The “Import CSV” button is not intended to be automated. It uses default Composite Application Framework (CAF) form requests that include the file content into its form-data (binary). This triggers validation and re-renders the portlet page accordingly. There is a REST interface for automated import/update of existing decision tables.

E.g. you could:

  • GET … decisionTable

  • Change (add some rules) to the JSON payload and

  • PUT … decisionTable

1 Like

Alternatively you could add a column with the environment and by that probably eliminate the need to import after deployment. I don’t know enough about your requirements to be able to say whether or not that approach will work. But perhaps it gives you ideas :slight_smile:

1 Like

Hi,

in this case I would suggest to define a global variable in IS Settings, i.e. envType, which is set to either DEV or PRD.
Pass this variable as an additional input to the decision table to retrieve either the value for DEV or PRD.

Regards,
Holger

1 Like

Hi guys, thank you for writing in.
I decided GET decisionTable, change JSON to add a rule (increment rule id, same column id, valid assignmentOperatorType and value fields with some new data), and PUT json to the table works best for my needs - exactly like this user
However, after the change in JSON and on PUT, I see this error:
com.webmethods.caf.rules.osgi.services.impl.MergingException: Adding new rules is not allowed yet
I’m running Business Rules 10.15.0.8.598 (fix WOK_10.15_RMC_Fix8), MWS 10.15.0.0002-0233 (fix MWS_10.15.0_Fix2)
Here’s a snippet of full.log

Caused by: com.webmethods.caf.rules.osgi.services.impl.MergingException: Adding new rules is not allowed yet.
	at com.webmethods.caf.rules.osgi.services.impl.DecisionTableMerger.mergeRules(DecisionTableMerger.java:93) ~[bundleFile/:?]
	at com.webmethods.caf.rules.publicapi.RuleProjectWrapper.mergeDecitionTable(RuleProjectWrapper.java:477) ~[bundleFile/:?]
	at com.webmethods.caf.rules.publicapi.RuleProjectWrapper.saveDecisionTable(RuleProjectWrapper.java:388) ~[bundleFile/:?]
	at com.webmethods.caf.rules.publicapi.RuleProjectWrapper.saveDecisionTable(RuleProjectWrapper.java:351) ~[bundleFile/:?]

I wrote how I’m transforming my JSON earlier - I don’t believe there’s an issue in the data I’m trying to PUT. Is this feature behind a newer fix, or am I doing something else wrong?

Hi,

your input data is most likely fine - the MergingException you are seeing indicates unsupported functionality. Specifically, adding new rows to a decision table is currenlty not supported by the PUT service. The service focuses on “changing values in an existing decision table” and not “modifying the structure of a decision table”.

We understand that this is not entirely satisfactory, but that is the current limitation of this REST API service. Please refer to this table for what functionality is supported:

regards,
Jörg

1 Like