How to use ABAP HTTP_POST
SAP has the function modules HTTP_GET and HTTP_POST to call remote urls. With HTTP_GET one can just had parameters in the URL to send information to the external system. For example, setting the url to
sends x=1 and y=10 as parameters to mypage. The problem with HTTP GET is that there is a limit on the ammount of data that can be sent (technically it is unlimited in the new specification, but there are still servers that impose the old limit).
To send large ammounts of data using HTTP one should use the POST method (ABAP function HTTP_POST). To accomplish the same call with HTTP_POST first the length of the data must be calculated
then the function must be called with the following parameters
The function group URL_GENERATION has some data quoting functions to help build valid URLs. Also, the introspector tool is helpful to debug the HTTP calls.
PS. This post was originally in pvl.freezope.org, but that site is down most of the time so I'm moving it here.
http://myserver.com/mypage?x=1&y=10
sends x=1 and y=10 as parameters to mypage. The problem with HTTP GET is that there is a limit on the ammount of data that can be sent (technically it is unlimited in the new specification, but there are still servers that impose the old limit).
To send large ammounts of data using HTTP one should use the POST method (ABAP function HTTP_POST). To accomplish the same call with HTTP_POST first the length of the data must be calculated
len("x=1&y=10") = 8
then the function must be called with the following parameters
ABSOLUTE_URI http://myserver.com/mypage
REQUEST_ENTITY_BODY_LENGTH 8
REQUEST_ENTITY_BODY x=1&y=10
The function group URL_GENERATION has some data quoting functions to help build valid URLs. Also, the introspector tool is helpful to debug the HTTP calls.
PS. This post was originally in pvl.freezope.org, but that site is down most of the time so I'm moving it here.