Page to handle post request

Hi All,

We are trying to accept post request from third party application into our Outsystems application. Requirement is to display the post attributes in Outsystems application page.

Is it possible to develop a page in Outsystems to handle post request from the third party site?

We have also tried exposing post rest service to accept post request, however there is no provision in Outsystems to redirect the captured post attributes to application page from server action.


Regards,

Varun

Hi Varun,

Yes that is possible. In traditional Web you would create a screen with input parameters attached to an entry point. In the preperation action you do the processing and then at the end redirect to a screen.

Like for example:


In Reactive Web you can use a similar pattern but then instead of the Preperation put your logic in the OnInitialize event handler:

Regards,

Daniel

Hi Daniel,

Thanks for the quick reply.

This may work with HTTP GET, but it is somehow not working as expected with POST request.Am i missing some essential trick here. What i need to write into initialize ? Do i need to create as many inputs as attributes in post request then only it will accept post? 

I am getting below error on redirection. Hence it very misleading.

Hi Varun,

You'r right, I didn't read carefully your post.

Thinking about your initial approach:

We have also tried exposing post rest service to accept post request, however there is no provision in Outsystems to redirect the captured post attributes to application page from server action.

You could try this (I didn't have time to try myself, sorry)

  1.  In the POST method, raise an exception, call the exception "PostCallBack".
  2. Use the exception message to store a serialized string of the POST parameters
  3. In the Common/OnException handler, add an exception handler for "PostCallBack"
  4. In the exception handler deserialize the exception message back to parameter values
  5. Set the destination screen with the parameters.

Regards,

Daniel

Hi Daniel,

I will try your suggestion and let you know if we get success. Appreciate your help.

Regards,

Varun

Hi Daniel,

Unfortunately suggested approach did not work as service do not have access to Common/OnException. We raised exception but it never invoked handler. Service life cycle ends at service response only. service life cycle to not have access to application level object.

Regards,

Varun.

I have a look at it tonight, and try to find out how this can be done.

I don't have a clear understanding of what you are trying to accomplish. If I understand correctly, you want to do a POST call from an external system to an Outsystems application, and then want to see the results of that call on a screen, right?
For now I see 2 solutions:
1. creating an exposed REST api, that recieves the request with all the input variables, and returns a complete html page in the response body
2. creating an exposed REST api, that recieves the request with all the input variables, and store it directly in the database. Then create a seperate screen that reads this information from the database. Return a url in the response

Hi Bas de Vries,

Current flow is 

1. Outsystems App Screen[say A] posts data with "ReturnURL" to Site ABC

2. User completes its task on Site ABC and press submit button (POST  request initiated on Site ABC for Outsystems app)

3. Request comes back to Outsystems Rest API (currently i have written Rest API to handle the request) but i am not able to redirect response to  Outsystems application page

So, Second option is not what we can do because it will break the journey. It has to be synchronous flow.

However, i did like first option (i.e. creating an exposed REST api, that receives the request with all the input variables, and returns a complete html page in the response body). I tried to set html content in response body, but it display HTML text as it is. Rather i would need to give button ot anchor tag so that on clicking i can go back to same page where journey started. 

Please let me know how i can returns a complete html page in the response body of REST API to display.