‎2015 Jun 15 2:30 PM
Dear experts,
I have an http communication - bidirectional - between SAP and a non-SAP system. In the direction from non-SAP to SAP, I defined a request handler using SE24 and SICF. Communication works fine.
My problem is to send a response from SAP to the non-SAP system. I see that SERVER input parameter of implemented method HANDLE_REQUEST gives access to the response object by calling IF_HTTP_SERVER->RESPONSE. To set the data of the response there is
IF_HTTP_RESPONSE->SET_DATA by passing xstring as input parameter.
What I do not understand is how to actually send these data to the client - the non-SAP system that originally sent a request to SAP. I see no send mehod in IF_HTTP_SERVER, there is only a method SEND_PAGE but I am not sure this is the right one.
Kind regards,
Konstantinos
‎2015 Jun 15 4:25 PM
Hi,
Not sure if it helps or not. But a pointer may be.
Did you check class CL_HTTP_SERVER method SEND_RESPONSE .
This class has used the interface IF_HTTP_SERVER , so ideally you can cast the instance of IF_HTTP_SERVER and call the method .
R
‎2015 Jun 15 4:25 PM
Hi,
Not sure if it helps or not. But a pointer may be.
Did you check class CL_HTTP_SERVER method SEND_RESPONSE .
This class has used the interface IF_HTTP_SERVER , so ideally you can cast the instance of IF_HTTP_SERVER and call the method .
R
‎2015 Jun 16 8:15 AM
Thanks a lot Rudra!
however I have the following code, not sure how to do it properly
* the following line is the importing parameter to class which is the http request handler
* and thus implements interface IF_HTTP_EXTENSION
* SERVER TYPE REF TO IF_HTTP_SERVER
FIELD-SYMBOLS: <ls> type REF TO CL_HTTP_SERVER.
................
ASSIGN server to <ls> CASTING.
which gives error when activating:
"<LS>" and "SERVER" contain references, internal tables, or strings. In
the current statement, these must occur at the same offset position and
they must be compatible.
How can I properly cast SERVER to type CL_HTTP_SERVER so that I use SEND_RESPONSE method?
Konstantinos
‎2015 Jun 16 9:33 AM
FYI I used the following code
data: lcl_cl_http_server type REF TO cl_http_server.
.......................
lcl_cl_http_server ?= server. "<-- widening cast
CLEAR: lv_rc.
CALL METHOD lcl_cl_http_server->SEND_RESPONSE
RECEIVING
RC = lv_rc.
and it seems to have worked (lv_rc is returned zero and the response was sent to client)
‎2015 Jun 16 10:05 AM
Yeah, That is the way to cast using "?=" in ABAP.
Glad to hear it worked.