Using Scoped REST Message within scoped application

abuthahir
Tera Expert

Hi All,

I have an Outbound REST message to post. I have created it within the scoped application and i have table in the same scope. I am trying to run a business rule script to run this REST Message whenever there is a record inserted. Am setting the body in a perfect manner still its not happening. [httpStatus is 0]. When i try the same body in the rRST message "Test" functionality its working perfectly. May i know what is the issue.? Please let me know . ctomasipradeepksharma kalai

var r = new sn_ws.RESTMessageV2('rest message name', 'post');

  var body = '{"JSON Body comes here"}';

  r.setRequestBody(body);

  var response = r.execute();

  var responseBody = response.getBody();

  var httpStatus = response.getStatusCode();

1 ACCEPTED SOLUTION

I wasn't aware of that either. Thank you for sharing Abu.



The only reason I can think of for blocking it is because REST, but default is a synchronous operation. For example, if it takes 10 seconds to get a response from the remote REST host, your browser is stuck waiting in a before/after business rule and presents a poor user experience. Async rules process in the background so the user doesn't have to wait.


View solution in original post

10 REPLIES 10

I wasn't aware of that either. Thank you for sharing Abu.



The only reason I can think of for blocking it is because REST, but default is a synchronous operation. For example, if it takes 10 seconds to get a response from the remote REST host, your browser is stuck waiting in a before/after business rule and presents a poor user experience. Async rules process in the background so the user doesn't have to wait.


Thank you so much for the quick response sir. Appreciate it.


You are very welcome. I'm glad you got your question answered. Thank you for participating in the community.


Hello there ctomasi,

 

I'm struggling with an Outbound REST Message & respective BR to trigger it to call a Scripted REST API on a second instance.

This is the scenario:

a. I created a Scripted REST API on instance 1 on a scoped Application;
b. I created an Outbound REST Message on instance 2 on 'Gobal' scope;
c. I created an Async BR on instance 2 on 'Global' scope to trigger above Outbound REST Message to create a record on instance 1 (using Scripted REST API defined in step a.).

The problem is that although the BR ran, it is not creating the record on instance 1.

If I use the 'Test' related link on the POST HTTP Method of the Outbound REST Message, the record is successfully created on instance 1, but not when I proceed with the BR via, i.e., when a record is inserted on a given 'Global' Table on instance 2.

 

Do you know what might be happening here?

 

Thanks in advance!

Fábio Gonçalves

Any update on this issue ?