<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: External REST API getting stuck in Receive Method in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/external-rest-api-getting-stuck-in-receive-method/m-p/12576429#M2008966</link>
    <description>&lt;P&gt;Hi Sandra,&lt;/P&gt;&lt;P&gt;In Postman tool, the response is coming from the API for the same request sent from the program.&lt;/P&gt;&lt;P&gt;In fact, if the program is executed again the response is coming.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vinod Iyer&lt;/P&gt;</description>
    <pubDate>Mon, 15 Aug 2022 13:39:46 GMT</pubDate>
    <dc:creator>rvinod1982</dc:creator>
    <dc:date>2022-08-15T13:39:46Z</dc:date>
    <item>
      <title>External REST API getting stuck in Receive Method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/external-rest-api-getting-stuck-in-receive-method/m-p/12576426#M2008963</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
  &lt;P&gt;I am getting data from a external system by calling the API created by the external system. &lt;/P&gt;
  &lt;P&gt;I have created an ABAP program and using CL_HTTP_CLIENT class for this. The steps being followed are as below:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;CALL METHOD cl_http_client=&amp;gt;create_by_url
EXPORTING
url = lv_full_url "( Here URL of the API is passed)
IMPORTING
client = o_http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
pse_not_found = 4
pse_not_distrib = 5
pse_errors = 6
OTHERS = 7.
IF sy-subrc &amp;lt;&amp;gt; 0.
* Implement suitable error handling here
ENDIF.

CALL METHOD o_http_client-&amp;gt;request-&amp;gt;set_method
EXPORTING
method = 'POST'.

o_http_client-&amp;gt;request-&amp;gt;set_header_field(
EXPORTING
name = 'Accept'
value = '*/*'
).

o_http_client-&amp;gt;request-&amp;gt;set_header_field(
EXPORTING
name = 'Content-Type'
value = 'application/json'
).

o_http_client-&amp;gt;request-&amp;gt;set_header_field(
EXPORTING
name = 'ApiOwner'
value = 'testowner'
).

o_http_client-&amp;gt;request-&amp;gt;set_header_field(
EXPORTING
name = 'ApiKey'
value = 'testkey'
).

CALL METHOD /ui2/cl_json=&amp;gt;serialize
EXPORTING
data = gs_op_req "( This structure contains the Request Body)
compress = abap_true
pretty_name = /ui2/cl_json=&amp;gt;pretty_mode-camel_case
RECEIVING
r_json = DATA(lv_json). "( The Request is converted to Json Format)

o_http_client-&amp;gt;request-&amp;gt;set_content_type( gc_app_json ).

CALL METHOD o_http_client-&amp;gt;request-&amp;gt;set_cdata
EXPORTING
data = lv_json.

CALL METHOD o_http_client-&amp;gt;send
EXCEPTIONS
http_communication_failure = 1 " Communication Error
http_invalid_state = 2 " Invalid state
http_processing_failed = 3 " Error when processing method
http_invalid_timeout = 4 " Invalid Time Entry
OTHERS = 5.

CALL METHOD o_http_client-&amp;gt;receive "( This method is running indefinitely)
EXCEPTIONS
http_communication_failure = 1 " Communication Error
http_invalid_state = 2 " Invalid state
http_processing_failed = 3 " Error when processing method
OTHERS = 4.

CALL METHOD o_http_client-&amp;gt;response-&amp;gt;get_status
IMPORTING
code = gv_http_status_code
reason = gv_http_status_text.

DATA: lr_data TYPE REF TO data.

gv_response_content = o_http_client-&amp;gt;response-&amp;gt;get_cdata( ).

CALL METHOD /ui2/cl_json=&amp;gt;deserialize
EXPORTING
json = gv_response_content
pretty_name = /ui2/cl_json=&amp;gt;pretty_mode-camel_case
assoc_arrays = abap_true
CHANGING
data = lr_data.

&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Many times the program gets stuck in the Receive method indefinitely and then the program needs to be terminated.&lt;/P&gt;
  &lt;P&gt;Then if the program is executed again with the same Request, it gets executed successfully.&lt;/P&gt;
  &lt;P&gt; The program is scheduled in background with a frequency of every 10 minutes.&lt;/P&gt;
  &lt;P&gt;What could be the reason of the program getting stuck in the Receive method.&lt;/P&gt;
  &lt;P&gt;Any help in this regard would be very much appreciated.&lt;/P&gt;
  &lt;P&gt;Regards,&lt;/P&gt;
  &lt;P&gt;Vinod Iyer&lt;/P&gt;</description>
      <pubDate>Sat, 13 Aug 2022 07:49:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/external-rest-api-getting-stuck-in-receive-method/m-p/12576426#M2008963</guid>
      <dc:creator>rvinod1982</dc:creator>
      <dc:date>2022-08-13T07:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: External REST API getting stuck in Receive Method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/external-rest-api-getting-stuck-in-receive-method/m-p/12576427#M2008964</link>
      <description>&lt;P&gt;The code formatting didn't work well. Possibly you may retry by using unformatted paste (Shfit+Ctrl+V).&lt;/P&gt;</description>
      <pubDate>Sat, 13 Aug 2022 08:41:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/external-rest-api-getting-stuck-in-receive-method/m-p/12576427#M2008964</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-08-13T08:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: External REST API getting stuck in Receive Method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/external-rest-api-getting-stuck-in-receive-method/m-p/12576428#M2008965</link>
      <description>&lt;P&gt;What happens if you do it with Postman or other such tool?&lt;/P&gt;</description>
      <pubDate>Sat, 13 Aug 2022 08:42:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/external-rest-api-getting-stuck-in-receive-method/m-p/12576428#M2008965</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-08-13T08:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: External REST API getting stuck in Receive Method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/external-rest-api-getting-stuck-in-receive-method/m-p/12576429#M2008966</link>
      <description>&lt;P&gt;Hi Sandra,&lt;/P&gt;&lt;P&gt;In Postman tool, the response is coming from the API for the same request sent from the program.&lt;/P&gt;&lt;P&gt;In fact, if the program is executed again the response is coming.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vinod Iyer&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 13:39:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/external-rest-api-getting-stuck-in-receive-method/m-p/12576429#M2008966</guid>
      <dc:creator>rvinod1982</dc:creator>
      <dc:date>2022-08-15T13:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: External REST API getting stuck in Receive Method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/external-rest-api-getting-stuck-in-receive-method/m-p/12576430#M2008967</link>
      <description>&lt;P&gt;Anybody got a solution for this ?&lt;/P&gt;&lt;P&gt;We have a similar issue, receive method hanging randomly. We are calling CPI from ECC using http client.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 17:40:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/external-rest-api-getting-stuck-in-receive-method/m-p/12576430#M2008967</guid>
      <dc:creator>anupcvarghese</dc:creator>
      <dc:date>2023-12-14T17:40:48Z</dc:date>
    </item>
  </channel>
</rss>

