The SAP standard function module HTTP_GET can be used to perform an HTTP GET Request from a target URL. The problem is that an RFC Lookup cannot be performed on that function module since it is not remote-enabled. The purpose of this PoC is to show the use(s) of remote-enabling this function module.
The exweb service which will be used is the Calculator web service (Add Operation) which can be found here: http://www.html2xml.nl/Services/Calculator/Version1/Calculator.asmx?op=Add
The service description for the HTTP GET is:
Take note that the request does not have an HTTP Body and that its parameters are all placed in the URL along with the GET method.
For simplicity, the remote-enabled function module will have to be created in your XI/PI system (after all, that is where the call takes place) and that it is also existing as a business system in your Integration Directory.
Once the function module HTTP_GET is executed in SE37, the service description above now translates into the values below:
And here is the response taken from the RESPONSE_ENTITY_BODY:
Importing:
Exporting
Tables
CALL FUNCTION 'HTTP_GET'
EXPORTING
ABSOLUTE_URI = ABSOLUTE_URI
REQUEST_ENTITY_BODY_LENGTH = REQUEST_ENTITY_BODY_LENGTH
RFC_DESTINATION = RFC_DESTINATION
PROXY = PROXY
PROXY_USER = PROXY_USER
PROXY_PASSWORD = PROXY_PASSWORD
USER = USER
PASSWORD = PASSWORD
BLANKSTOCRLF = BLANKSTOCRLF
TIMEOUT = TIMEOUT
IMPORTING
STATUS_CODE = STATUS_CODE
STATUS_TEXT = STATUS_TEXT
RESPONSE_ENTITY_BODY_LENGTH = RESPONSE_ENTITY_BODY_LENGTH
TABLES
REQUEST_ENTITY_BODY = REQUEST_ENTITY_BODY
RESPONSE_ENTITY_BODY = RESPONSE_ENTITY_BODY
RESPONSE_HEADERS = RESPONSE_HEADERS
REQUEST_HEADERS = REQUEST_HEADERS
EXCEPTIONS
CONNECT_FAILED = 1
TIMEOUT = 2
INTERNAL_ERROR = 3
TCPIP_ERROR = 4
DATA_ERROR = 5
SYSTEM_FAILURE = 6
COMMUNICATION_FAILURE = 7.
endfunction.
Save and Activate.
Take note that the unused fields are deleted. So for our example:
Note: LookUp In 2 is for a proxy server.
And the result of the lookup below:
Sample request mapping:
Sample response mapping:
The actual response seen in SXI_MONITOR:
The HTTP Response Headers are placed on the Response Headers.
With that, this Proof of Concept ends. I hope that this document has been informative and leave it up to the developer to explore on error handling, the use of SSL (for https)... Have fun exploring!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
9 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |