Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Read file from HTTP server.

PratibhaK
Participant
0 Likes
465

Hi,

I want to read a file on http server of a 3rd party application, in R/3 system.

How can this be acheived?

Kindly help!

Thanks,

Pratibha.

1 REPLY 1
Read only

frank_stdle
Participant
0 Likes
389

The following code will POST a parameter to a server and receive data:


DATA: lo_client TYPE REF TO if_http_client,                                      
      lv_url TYPE string VALUE 'http://someserver.com/'                                                                                
CALL METHOD cl_http_client=>create_internal                                      
  IMPORTING                                                                      
    client = lo_client.                                                                                
cl_http_utility=>set_request_uri( request  = lo_client->request                  
                                  uri      = lv_url ).                           
lo_client->request->set_header_field( name  = '~request_method'                  
                                      value = 'POST' ).                          
lo_client->request->set_form_field( EXPORTING name  = 'myfield'                  
                                              value = 'myvalue' ).               
lo_client->send( ).                                                                                
* get response                                                                   
      call method li_client->receive                                             
        exceptions                                                               
          http_communication_failure = 1                                         
          http_invalid_state         = 2                                         
          http_processing_failed     = 3                                         
          others                     = 4.                                        

However, you might be better of creating a web service for this kind of communication.

regards

Frank