<?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: Outbound HTTP POST: SAP reorders headers in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/outbound-http-post-sap-reorders-headers/qaa-p/776215#M230441</link>
    <description>&lt;P&gt;I do not have experience with a "multipart" so excuse me if it is wrong idea. But what if you set headers with &lt;STRONG&gt;lo_http_client&lt;/STRONG&gt;-&amp;gt;request instead of &lt;STRONG&gt;lo_multipart&lt;/STRONG&gt; ?&lt;/P&gt;&lt;P&gt;Also have you tried to use this parameter?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF_HTTP_ENTITY~ADD_MULTIPART method with parameter SUPPRESS_CONTENT_LENGTH&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;instead of:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;lo_multipart-&amp;gt;suppress_content_type method&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Also you can try set_header_fields instead of set_header_field. But it will probably also will be reordered &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2019 07:22:14 GMT</pubDate>
    <dc:creator>Tomas_Buryanek</dc:creator>
    <dc:date>2019-03-05T07:22:14Z</dc:date>
    <item>
      <title>Outbound HTTP POST: SAP reorders headers</title>
      <link>https://community.sap.com/t5/technology-q-a/outbound-http-post-sap-reorders-headers/qaq-p/776214</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;I have a strange problem using cl_http_client. I want to do a mulitpart POST, but SAP (maybe the ICM?) reorders the HTTP headers I add using CALL METHOD lo_multipart-&amp;gt;set_header_field and also adds Content-Length.&lt;/P&gt;
  &lt;P&gt;So even if I add the headers in the order 1: Content-Disposition 2: Content-Type, the outgoing request will contain it in another order and Content-Length added:&lt;/P&gt;
  &lt;P&gt;1: Content-Type 2: Content-Length 3: Content-Disposition.&lt;/P&gt;
  &lt;P&gt;Using lo_multipart-&amp;gt;suppress_content_type does not change anything either.&lt;/P&gt;
  &lt;P&gt;However, the external platform I'm interfacing with is sensitive to the order of headers, and will NOT work, if Content-Disposition is not the first header.&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;Is it possible to configure or turn off this behavior of SAP?&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;Please check the example below.&lt;/P&gt;
  &lt;P&gt;Thanks and best regards,&lt;/P&gt;
  &lt;P&gt;Tamás&lt;/P&gt;
  &lt;P&gt;ABAP Code:&lt;/P&gt;
  &lt;P&gt;...&lt;/P&gt;
  &lt;P&gt;lo_multipart = lo_http_client-&amp;gt;request-&amp;gt;if_http_entity~add_multipart( ).&lt;BR /&gt; CALL METHOD lo_multipart-&amp;gt;suppress_content_type EXPORTING suppress = 'X'.&lt;BR /&gt; &lt;BR /&gt; CONCATENATE 'form-data; name="file"; filename="' iv_filename '";' INTO lv_form_value.&lt;BR /&gt; *&lt;BR /&gt; CALL METHOD lo_multipart-&amp;gt;set_header_field&lt;BR /&gt; EXPORTING&lt;BR /&gt; name = 'Content-Disposition'&lt;BR /&gt; value = lv_form_value.&lt;BR /&gt; &lt;BR /&gt; CALL METHOD lo_multipart-&amp;gt;set_content_type&lt;BR /&gt; EXPORTING&lt;BR /&gt; content_type = iv_content_type.&lt;BR /&gt; &lt;BR /&gt; CALL METHOD lo_multipart-&amp;gt;set_data&lt;BR /&gt; EXPORTING&lt;BR /&gt; data = iv_xstring.&lt;/P&gt;
  &lt;P&gt;...&lt;/P&gt;
  &lt;P&gt;Outgoing HTTP request:&lt;/P&gt;
  &lt;P&gt;--F2814BF8064476F37754F550F04B29960 &lt;/P&gt;
  &lt;P&gt; &lt;STRONG&gt;Content-Type: text/html &lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt; &lt;STRONG&gt;Content-Length: 8925 &lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt; &lt;STRONG&gt;content-disposition: form-data; name="file"; filename="SU53_output_passed_INC-000444_S72_20190227.html"; &lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&amp;lt;html dir="ltr"&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;&amp;lt;title&amp;gt;Report output&amp;lt;/title&amp;gt; &amp;lt;style&amp;gt;table.list { border-collapse: collapse; }&amp;lt;/style&amp;gt; &amp;lt;/head&amp;gt; &amp;lt;!script!&amp;gt; &amp;lt;body bgcolor="#E8EAD8"&amp;gt; ... DATA&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2019 13:27:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/outbound-http-post-sap-reorders-headers/qaq-p/776214</guid>
      <dc:creator>former_member374753</dc:creator>
      <dc:date>2019-03-04T13:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Outbound HTTP POST: SAP reorders headers</title>
      <link>https://community.sap.com/t5/technology-q-a/outbound-http-post-sap-reorders-headers/qaa-p/776215#M230441</link>
      <description>&lt;P&gt;I do not have experience with a "multipart" so excuse me if it is wrong idea. But what if you set headers with &lt;STRONG&gt;lo_http_client&lt;/STRONG&gt;-&amp;gt;request instead of &lt;STRONG&gt;lo_multipart&lt;/STRONG&gt; ?&lt;/P&gt;&lt;P&gt;Also have you tried to use this parameter?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF_HTTP_ENTITY~ADD_MULTIPART method with parameter SUPPRESS_CONTENT_LENGTH&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;instead of:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;lo_multipart-&amp;gt;suppress_content_type method&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Also you can try set_header_fields instead of set_header_field. But it will probably also will be reordered &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 07:22:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/outbound-http-post-sap-reorders-headers/qaa-p/776215#M230441</guid>
      <dc:creator>Tomas_Buryanek</dc:creator>
      <dc:date>2019-03-05T07:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Outbound HTTP POST: SAP reorders headers</title>
      <link>https://community.sap.com/t5/technology-q-a/outbound-http-post-sap-reorders-headers/qaa-p/776216#M230442</link>
      <description>&lt;P&gt;Dear Tomas,&lt;/P&gt;&lt;P&gt;You've made my day!!! At least partly &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I overlooked the "suppress_content_length" parameter, thanks for pointing that out.&lt;/P&gt;&lt;P&gt;As Content-Type was mandatory in the external system, I had to do another trick:&lt;STRONG&gt; add two headers into one line&lt;/STRONG&gt;... this way SAP does not reorganize it :DD&lt;/P&gt;&lt;P&gt;Now everything works as expected: Integration of SAP and Efecte ITSM systems: &lt;A href="https://youtu.be/N7BFkcty-XI" target="test_blank"&gt;https://youtu.be/N7BFkcty-XI&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Have a nice day!&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Tamás&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 09:11:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/outbound-http-post-sap-reorders-headers/qaa-p/776216#M230442</guid>
      <dc:creator>former_member374753</dc:creator>
      <dc:date>2019-03-05T09:11:27Z</dc:date>
    </item>
  </channel>
</rss>

