<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: How to use initial HTTP request (not from HTTP client) in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/how-to-use-initial-http-request-not-from-http-client/qaa-p/13942345#M4893072</link>
    <description>&lt;P&gt;When creating the new request by using a system call like in the original SAP code I receive a 401 response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;SYSTEM-CALL ict "#EC CI_SYSTEMCALL
  DID
    ihttp_scid_create_message
  PARAMETERS
    1
    message_pointer
    error.

DATA(request) = NEW cl_http_request( c_msg = message_pointer ).&lt;/LI-CODE&gt;&lt;P&gt;EDIT: Solved. Added the authentication credentials to the request by calling&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;request-&amp;gt;set_authorization( .. )&lt;/LI-CODE&gt;&lt;P&gt;Now it works. But I'm still not sure if this is a recommended solution to solve this.&lt;BR /&gt;Not sure about the side effects and functionality of the system call. Guess that it simply creates a new memory buffer to store the request...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Nov 2024 15:36:57 GMT</pubDate>
    <dc:creator>dschiener</dc:creator>
    <dc:date>2024-11-19T15:36:57Z</dc:date>
    <item>
      <title>How to use initial HTTP request (not from HTTP client)</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-use-initial-http-request-not-from-http-client/qaq-p/13942312</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I want to send a newly created HTTP request based on &lt;EM&gt;if_http_request&lt;/EM&gt; or &lt;EM&gt;cl_http_request&lt;/EM&gt;&amp;nbsp;without using the request which is stored in the HTTP client.&lt;/P&gt;&lt;P&gt;I guess the default way to send a HTTP request looks kind of like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;DATA(client) = cl_http_client=&amp;gt;create( ).
" Prepare request
client-&amp;gt;request-&amp;gt;set_method( ... ).
client-&amp;gt;request-&amp;gt;set_header_field( ... ).
...

client-&amp;gt;send( ... ).&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By debugging, this way is working, not least because the request object stored in the client contains a member attribute named &lt;EM&gt;m_c_msg&lt;/EM&gt; that is initialized.&lt;/P&gt;&lt;P&gt;I would like to decouple the creation and initialization of the HTTP request by underlying the HTTP client:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;DATA(client) = cl_http_client=&amp;gt;create( ).

" Prepare request
DATA(request) = NEW cl_http_request( ).
request-&amp;gt;set_method( ... ).
request-&amp;gt;set_header_field( ... ).
...

client-&amp;gt;request = request.
client-&amp;gt;send( ... ).&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my way the request seems not to be initialized correctly and therefore the sending fails.&lt;/P&gt;&lt;P&gt;Can anyone tell me if it is possible to implement my prefered solution and give me some hints?&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 13:57:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-use-initial-http-request-not-from-http-client/qaq-p/13942312</guid>
      <dc:creator>dschiener</dc:creator>
      <dc:date>2024-11-19T13:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use initial HTTP request (not from HTTP client)</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-use-initial-http-request-not-from-http-client/qaa-p/13942345#M4893072</link>
      <description>&lt;P&gt;When creating the new request by using a system call like in the original SAP code I receive a 401 response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;SYSTEM-CALL ict "#EC CI_SYSTEMCALL
  DID
    ihttp_scid_create_message
  PARAMETERS
    1
    message_pointer
    error.

DATA(request) = NEW cl_http_request( c_msg = message_pointer ).&lt;/LI-CODE&gt;&lt;P&gt;EDIT: Solved. Added the authentication credentials to the request by calling&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;request-&amp;gt;set_authorization( .. )&lt;/LI-CODE&gt;&lt;P&gt;Now it works. But I'm still not sure if this is a recommended solution to solve this.&lt;BR /&gt;Not sure about the side effects and functionality of the system call. Guess that it simply creates a new memory buffer to store the request...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 15:36:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-use-initial-http-request-not-from-http-client/qaa-p/13942345#M4893072</guid>
      <dc:creator>dschiener</dc:creator>
      <dc:date>2024-11-19T15:36:57Z</dc:date>
    </item>
  </channel>
</rss>

