HTTP Postback via HTTP Post

HTTP Postback via HTTP Post

  

Hi,

We currently have a requirement with this specification: 

Postback, notifications are sent by our server via HTTP POST. Yourpostback handler should not return a UI, but should return a plaintext (nohtml, no quotes) "result=OK". OK can be any value that can havenumbers, letters and underscores. e.g. result=FAIL_DIGEST_MISMATCH


How can this be implemented through Outsystems? It is a third party gateway we will be integrating with.

Hi,


I think you can do it with a rest expose method.

Just an output parameter in the body.


Otherwise a simple page where in the preparation you do a download of a file which is your text.

I have exposed a rest method for this however, we received the following advise from our partner:

The postback is getting an HTTP POST, while the return is getting anHTTP GET. Most languages and frameworks treat the parameters for these twomethods separately. In PHP, you can use the $_GET and the $_POST parameter. Ifyou are using these variables to access the parameters, or an analog of these, you would not "see"the parameters if a different HTTP method was used to what you were expecting.You can also use the $_REQUEST parameter, which should include parameters fromHTTP POST and HTTP GET. Other frameworks, like .Net, would have an analog ofthe $_GET, $_POST, and $_REQUEST as well.


How can this be implemented in outsystems?

Hello Geraldine,

I if understand you correctly, you should just need to change the HTTP Method of your REST API, like this:

I hope this helps you.

Sincerely,

Pedro Guimarães

Hi Pedro Guimarães,

That was the first thing I did actually.. however, it is giving them this error:


Upon trying in Postman, the following was the error:

{
  "Errors": [
    "The 'txnid' URL parameter is missing in the request.",
    "The 'refno' URL parameter is missing in the request.",
    "The 'status' URL parameter is missing in the request.",
    "The 'message' URL parameter is missing in the request.",
    "The 'digest' URL parameter is missing in the request."
  ],
  "StatusCode": 400
}


Yes, the REST received 5 parameters and returns 1 parameter. 

We have consulted this with our partner and the response was: 

The postback is getting an HTTP POST, while the return is getting an HTTP GET. Most languages and frameworks treat the parameters for these two methods separately. In PHP, you can use the $_GET and the $_POST parameter. If you are using these variables to access the parameters, or an analog of these, you would not "see" the parameters if a different HTTP method was used to what you were expecting. You can also use the $_REQUEST parameter, which should include parameters from HTTP POST and HTTP GET. Other frameworks, like .Net, would have an analog of the $_GET, $_POST, and $_REQUEST as well.


Hi Geraldine,


Ok, let me see if I got this right: you want, from OutSystems, to invoke an external REST service and are having troubles? But it's not just on OutSystems, because if you call it from outside like in Postman it also happens.

I don't know, maybe it's one of this:
- the HTTP request method used by the client is not the one the server expects (not likely as you already checked it)
- the parameters aren't being passed in the right place - by the error message, it looks you aren't passing them on the URL. In OutSystems, make sure the URL includes the parameters, e.g. <OriginalUrl>?txnid={txnid}&refno={refno}&status={status}&message={message}&digest={digest} - that will generate 5 input parameters and each should have the 'Send In' property set to 'URL'.
- the parameters are defined but aren't being sent and the web service requires them: you can change the parameter's Send Default Value to Yes, or mark it as Mandatory. Try to pass some test values.


Cheers