Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn!
my problem seems to be sooo simple, yet I struggle with the details.
- implement an one way interface between PTC RV&S (12.3 ++) and an external webservice that offers a RestAPI ("fire & forget")
- a rule based post event trigger shall fire in case the PTC item reaches a certain state.
- the custom JS trigger script transfer the ID of a PTC item to an external webservice as follows:
1. prepare the POST message containing the ID as a JSON format
2. sends the data to a (hardcoded) URL
3. receive the response and log success OR error
- inside the custom JS trigger code step 1 is easy, but the actual sending of the POST request seams to be extremely tricky
I tried to use the
mks.frame.triggers.beans.ScriptProcessBuilderBean - to create a
mks.frame.triggers.beans.ScriptProcessBean - that should run a CURL command performing the actual webrequest
As this did not work I tried a PowerShell process, using a one-line script for the required actions.
mks.frame.triggers.beans.ScriptProcessBean does allow me use it's OutputStream
public java.io.OutputStream getOutputStream()
but somehow this does not work for me 😞
Can anyone provide me a working sample on how to access the Output of the ScriptProcessBean in a trigger script?
Or even better, does anyone have any idea how I can make my webrequest without the ScriptProcessBean?