Specifically: how to code the body in the post request? What would the values be for “signature” and how does the “sourceCode”/“script” need to be encoded considering it’s java code enclosed in xml?
I would recommend installing the following extension in VS Code: IdentityNow Extensions for Visual Studio Code. This will let you more easily edit your source without needing to use Postman for these operations.
Once you’ve connected your tenant, you can create a new rule and can select the Web Service before operation rule:
You can leverage the samples from the post you linked to get started on the rule. If you right click this rule in VS Code, you can edit the script in standard java, rather than needing to translate it and put it in sourceCode/script.
To then link it back to a specific operation, you can go into the source in VS Code, and add the following tag into each HTTP operation you want the rule to run on: "beforeRule": "<insert rule name>"
it throws a parse error. The java class is 60 lines. I just copy/pasted it between the double quotes of the script tag…Does the code need to be reformatted/escaped?
There is also a VSCode plugin called “JSON Escaper” that will escape or unescape whatever is highlighted instead of having to do a find/replace. I’ve used this for years and it really helps with rule script formatting (mainly before the ISC VSCode extension had the right click option). Once installed, you can highlight the code you want to (un)esapce, hit CTRL+Shift+P, and selece “Unescape JSON String” or “Escape JSON String” to format the script correctly.