222
Views
8
Comments
Solved
Consume REST API Response getting as NULL values.
Question
Application Type
Reactive

Hi Team,

I created consume Rest API attached below image having Input parameter as Request (MessageHeader & MessagePayload).

Input Parameter which I need to pass MessagePayload.Payload is XML data passing it as text.



Passing URL, Payload and SOAPAction while calling REST method.



When I check it in postman I'm getting the Response as below image.



When I did debugging, I found this getting NULL values from output parameters.



But one thing I need to mention that Rest API was getting called and creating an instance and registered the log values as SUCCESS.

But those response was not getting the output (MessagePayload.Response & MessagePayload.StatusCode).

Please help me in this issue which I'm facing.

Thanks in advance
Palle Vijay Bhaskar Reddy

2022-02-23 11-51-04
Vijay Bhaskar Reddy Palle
Solution

Hi,

Thank you for the help and your efforts @Devendra Singh Baghel .

When I added the OnBeforeRequest and OnAfterRequest and tried with debugging the values were copying into the exact output of Response.

But the thing when I created one server action and Output parameter as same Response and called the REST call Method in Server action. output values copying into local variable

Then I'm able to check and copy the Output of my REST.

- Palle Vijay Bhaskar Reddy

2020-09-18 09-37-36
Devendra Baghel

Hi Vijay,

Can you try by creating the Consume REST API method output structure by the JSON result that you are getting from POST MAN. 

Best Regards

Devendra



2022-02-23 11-51-04
Vijay Bhaskar Reddy Palle

Hi @Devendra Singh Baghel ,

Thank you for the responding, Yes I did the same.

when I tested the requested body with the sample JSON structure I copied the response body.

It created the JSON structure only. 


Structure image is below.


2020-09-18 09-37-36
Devendra Baghel

Hi Vijay,

Have you try to log the response from the REST API in OnAfterResponse event . Some thing like below.

Best Regards

Devendra

2022-02-23 11-51-04
Vijay Bhaskar Reddy Palle

Hi @Devendra Singh Baghel,

Yes, tried after your comments.

Attaching the result as below screenshot.
While debugging.


and what are the values I need to pass for LogMessage.

2020-09-18 09-37-36
Devendra Baghel

Hi Vijay,

As seen in above image seems like you are not getting proper response from REST API and thats why its not able to populate it to the structure. may be you are missing some header , payload or some auth cookiee you need to compare with the POSTMAN REST request .

Best Regards

Devendra


2022-02-23 11-51-04
Vijay Bhaskar Reddy Palle

Hi @Devendra Singh Baghel ,

I'm passing all the headers with accurate and there is no any authentication as well.

POSTMAN REST request is working that I mentioned earlier that Input of payload is of XML type
by using free formatter json escape I pasted the XML data and formatted the JSON string escape and copy pasted in the source payload.

as attaching in the below image.


Help me with passing the payload which is in XML format as the above which I mentioned by using JSON Escape.

Thanks in Advance.

2020-09-18 09-37-36
Devendra Baghel

Hi Vijay

As you mentioned that you are escaping your XML content before sending to the POSTMAN . Are you doing same before sending it to the RESP API call from outsystems. 

May be you can try with replacing the double quote with backslash and double quote of XML text content

you can refer below link 

https://www.outsystems.com/forums/discussion/51193/replace-single-double-quote/

Best Regards

Devendra

2022-02-23 11-51-04
Vijay Bhaskar Reddy Palle
Solution

Hi,

Thank you for the help and your efforts @Devendra Singh Baghel .

When I added the OnBeforeRequest and OnAfterRequest and tried with debugging the values were copying into the exact output of Response.

But the thing when I created one server action and Output parameter as same Response and called the REST call Method in Server action. output values copying into local variable

Then I'm able to check and copy the Output of my REST.

- Palle Vijay Bhaskar Reddy

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.