webMethods

 View Only
Expand all | Collapse all

Automating csv imports into webMethods Business Rules

  • 1.  Automating csv imports into webMethods Business Rules

    Posted Tue January 02, 2024 08:01 AM

    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.


    #Integration-Server-and-ESB
    #webMethods
    #CSV
    #Automation


  • 2.  RE: Automating csv imports into webMethods Business Rules

    Posted Tue January 02, 2024 08:12 AM

    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


    #Automation
    #Integration-Server-and-ESB
    #webMethods
    #CSV


  • 3.  RE: Automating csv imports into webMethods Business Rules

    Posted Wed January 03, 2024 03:20 AM

    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


    #CSV
    #Automation
    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Automating csv imports into webMethods Business Rules

    Posted Wed January 03, 2024 07:53 AM

    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.


    #CSV
    #webMethods
    #Integration-Server-and-ESB
    #Automation


  • 5.  RE: Automating csv imports into webMethods Business Rules

    Posted Wed January 03, 2024 09:07 AM

    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


    #Automation
    #CSV
    #webMethods
    #Integration-Server-and-ESB


  • 6.  RE: Automating csv imports into webMethods Business Rules

    Posted Wed January 03, 2024 10:23 AM

    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


    #Automation
    #webMethods
    #Integration-Server-and-ESB
    #CSV


  • 7.  RE: Automating csv imports into webMethods Business Rules

    Posted Thu January 04, 2024 02:27 AM

    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:


    #Integration-Server-and-ESB
    #CSV
    #Automation
    #webMethods


  • 8.  RE: Automating csv imports into webMethods Business Rules

    Posted Thu January 04, 2024 06:53 AM

    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


    #Automation
    #CSV
    #Integration-Server-and-ESB
    #webMethods


  • 9.  RE: Automating csv imports into webMethods Business Rules

    Posted Mon January 29, 2024 05:30 AM

    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?


    #Integration-Server-and-ESB
    #webMethods
    #Automation
    #CSV


  • 10.  RE: Automating csv imports into webMethods Business Rules

    Posted Tue January 30, 2024 08:49 AM

    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


    #CSV
    #Integration-Server-and-ESB
    #Automation
    #webMethods