I am trying to communicate with a Cloud service ( http://api.cospace.de ) using class CL_HTTP_CLIENT.
My problem is that I need to change the host name during the communication. (A similar problem can be found CL_HTTP_CLIENT authentication and data hosts are not same but was not solved in ABAP there).
The REST interface needs to be addressed this way:
In ABAP I use cl_http_client=>create_by_url for step 1 and do the GET command. Now I need to change the host for the POST command in step 2.
I tried to use
call method ro_api->o_client->request->set_header_field exporting name = '~host' value = 'api01.cospace.de'.
but this does not seem to work.
Could this work in general? In Python you would change the socket of the http client for doing this. But is anything similar possible in ABAP?