cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Windchill RV+S - Use trigger script to call an external RestAPI webservice

mrump
14-Alexandrite

Windchill RV+S - Use trigger script to call an external RestAPI webservice

Hi all,

my problem seems to be sooo simple, yet I struggle with the details.

 

The GOAL:

- implement an one way interface between PTC RV&S (12.3 ++) and an external webservice that offers a RestAPI  ("fire & forget")

 

Approach:

- 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 

 

The PROBLEM:

- 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.

 

Unfortunately the 

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?

 

 

0 REPLIES 0
Announcements


Top Tags