Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9656

cl_http_client usage causing Web UI timeout

$
0
0

Hello,

 

I'm currently running into an issue when triggering a mobile notification (via HTTP post) from Web UI and was wondering if anyone had any experience doing this or thoughts on my issue.

 

I have it set up to trigger the mobile notification when saving a service request. The notification itself works great and reaches our mobile devices, but afterwards the next action performed in Web UI results in a 500 timeout.

 

I've determined the issue is caused whenever I close the HTTP connection I opened to send out the notification. If I remove the code which closes the connection, then there is no timeout issue. However, I didn't want to just open the connection then not close it so I wanted to see if anyone knew why it would be timing out.

 

Here are the relevant portions from my code:

 

DATA:

           lr_client     TYPE REF TO if_http_client.

 

* Create URL

       cl_http_client=>create_by_url( EXPORTING url        = lv_device_url

                                      IMPORTING client     = lr_client

                                      EXCEPTIONS

                                        argument_not_found = 1

                                        plugin_not_active  = 2

                                        internal_error     = 3

                                        OTHERS             = 4          ).


       lr_client->request->set_method( 'POST' ).


*     Content Type

       lr_client->request->set_header_field( EXPORTING name  = 'Content-Type'

                                                       value = 'application/xml' ).


*     Authentication

       lr_client->request->set_header_field( EXPORTING name  = 'Authorization'

                                                       value = lv_auth       ).


*     Message to User

       lr_client->request->set_header_field( EXPORTING name  = 'X-SMP-APNS-ALERT'

                                                       value = lv_notif ).

*     Alert Sound

       lr_client->request->set_header_field( EXPORTING name  = 'X-SMP-APNS-SOUND'

                                                       value = 'Default' ).


*      Send Request

       lr_client->send( EXCEPTIONS http_communication_failure = 1 http_invalid_state = 2 ).


CALL METHOD lr_client->receive(

         EXCEPTIONS

           http_communication_failure = 1

           http_invalid_state         = 2

           http_processing_failed     = 3 ).



lr_client->close( ).


Any thoughts on this issue would be appreciated. Thank you.


Viewing all articles
Browse latest Browse all 9656

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>