<?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: Cannot send HTTP Content-Type header without charset... in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaa-p/13962275#M4896052</link>
    <description>&lt;P&gt;To avoid charset=UTF-8&lt;BR /&gt;&lt;BR /&gt;I am referencing variables from your code for you to better understand, just add below code&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;lo_client_acct-&amp;gt;request-&amp;gt;suppress_charset ( supress = abap_true ).&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ajinkya Chothave&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Dec 2024 17:35:21 GMT</pubDate>
    <dc:creator>ajinkyachothave-1</dc:creator>
    <dc:date>2024-12-12T17:35:21Z</dc:date>
    <item>
      <title>Cannot send HTTP Content-Type header without charset value</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaq-p/12324906</link>
      <description>&lt;P&gt;Hello Community,&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt; I am trying to set up a http request from abap against an external server.&lt;/P&gt;
  &lt;P&gt;The Request is a Post request which hast to be the exact Content-Type 'application/jose+json'.&lt;/P&gt;
  &lt;P&gt;My abap http client is setting the header field perfectly well but SAP seems to be sending:&lt;/P&gt;
  &lt;P&gt;content-Type: "application/jose+jason; charset=utf-8".&lt;/P&gt;
  &lt;P&gt;which conflicts with the check on server side I am sending it to.&lt;/P&gt;
  &lt;P&gt;I already found a sap note which wants me to update my REST client.&lt;/P&gt;
  &lt;P&gt;&lt;A href="https://launchpad.support.sap.com/#/notes/2456232/E" target="test_blank"&gt;https://launchpad.support.sap.com/#/notes/2456232/E&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt;So it seems to be a common problem&lt;/P&gt;
  &lt;P&gt;The problem is I only get .SCA files and I don't get how to get them into my ABAP stack SAP System.&lt;/P&gt;
  &lt;P&gt;My setup is:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;Component    Release        SP-Level    Support Package
SAP_BASIS    752            0006      SAPK-75206INSAPBASIS  
SAP_ABA      752            0006      SAPK-75206INSAPABA      
SAP_GWFND    752            0006      SAPK-75206INSAPGWFND    
SAP_UI       752            0009      SAPK-75209INSAPUI       
ST-PI        740            0013      SAPK-74013INSTPI        
SAP_BW       752            0006      SAPK-75206INSAPBW        
UIBAS001     300            0006      SAPK-30006INUIBAS001    
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Thank you for anything that gets me closer to a solution.&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;Regards,&lt;/P&gt;
  &lt;P&gt;Robin&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 06:36:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaq-p/12324906</guid>
      <dc:creator>robin_k</dc:creator>
      <dc:date>2021-03-05T06:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot send HTTP Content-Type header without charset value</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaa-p/12324907#M4617245</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The note you're looking at is only relevant for XI (SAP Process Orchestration - PI), so that note is not going to solve your problem I guess.&lt;/P&gt;&lt;P&gt;Can you share at least a code snippet to see how you're sending the HTTP requests from ABAP?&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Geert-Jan Klaps&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 12:19:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaa-p/12324907#M4617245</guid>
      <dc:creator>geert-janklaps</dc:creator>
      <dc:date>2021-03-05T12:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot send HTTP Content-Type header without charset value</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaa-p/12324908#M4617246</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you for responding!&lt;/P&gt;&lt;P&gt;Here is some code I actually use. Very much simplified for showing the communication part.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT zrk_test_013.

DATA: lo_client_dir TYPE REF TO if_http_client.
DATA: lo_client_nonce TYPE REF TO if_http_client.
DATA: lo_client_acct TYPE REF TO if_http_client.
DATA: lv_httpcode TYPE i.
DATA: lv_reason TYPE string.
DATA lv_response_acct          TYPE string.
DATA lo_rest_client_acct   TYPE REF TO cl_rest_http_client.
DATA lo_response_acct      TYPE REF TO if_rest_entity.
DATA lo_request_acct       TYPE REF TO if_rest_entity.


CALL METHOD cl_http_client=&amp;gt;create_by_url
  EXPORTING
    url                = 'https://testingjsonposts0987.requestcatcher.com/'
*   proxy_host         =
*   proxy_service      =
*   ssl_id             =
*   sap_username       =
*   sap_client         =
*   proxy_user         =
*   proxy_passwd       =
  IMPORTING
    client             = lo_client_acct
  EXCEPTIONS
    argument_not_found = 1
    plugin_not_active  = 2
    internal_error     = 3
    OTHERS             = 4.
IF sy-subrc &amp;lt;&amp;gt; 0.
  FORMAT INVERSE ON COLOR 6. FORMAT INVERSE ON COLOR 6.
  WRITE: / 'cl_http_client=&amp;gt;create_by_url' . FORMAT COLOR OFF INVERSE OFF.
ENDIF.


IF lo_client_acct IS BOUND.

* Instantiate REST client
  CREATE OBJECT lo_rest_client_acct
    EXPORTING
      io_http_client = lo_client_acct.


  DATA lv_post_data TYPE string.
  DATA lv_con_len TYPE string.



  lo_client_acct-&amp;gt;request-&amp;gt;set_method( if_http_request=&amp;gt;co_request_method_post ).


  lv_post_data = '{ Json example data }'. " For showing purpose only.


  lo_request_acct = lo_rest_client_acct-&amp;gt;if_rest_client~create_request_entity( ).

  lo_request_acct-&amp;gt;set_content_type( iv_media_type = 'application/jose+json' ).

  lo_request_acct-&amp;gt;set_header_field( iv_name = 'content-encoding'
                                iv_value = 'gzip' ).

  lo_client_acct-&amp;gt;request-&amp;gt;set_version( '1001' ).


  lo_client_acct-&amp;gt;request-&amp;gt;set_cdata( lv_post_data ).

  lv_con_len = lo_request_acct-&amp;gt;get_content_length( ).
  lo_request_acct-&amp;gt;set_header_field( iv_name = if_http_header_fields=&amp;gt;content_length
                                iv_value = lv_con_len ).


*   Debugginginformation
  DATA(x01) = lo_request_acct-&amp;gt;get_header_fields( ).

* Send the HTTP request
  CALL METHOD lo_client_acct-&amp;gt;send
    EXCEPTIONS
      http_communication_failure = 1
      http_invalid_state         = 2
      http_processing_failed     = 3
      http_invalid_timeout       = 4
      OTHERS                     = 5.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    FORMAT INVERSE ON COLOR 6.
    WRITE: / 'lo_client_acct-&amp;gt;send'. FORMAT COLOR OFF INVERSE OFF.
  ENDIF.

* HTTP call receive
  CALL METHOD lo_client_acct-&amp;gt;receive
    EXCEPTIONS
      http_communication_failure = 1
      http_invalid_state         = 2
      http_processing_failed     = 3
      OTHERS                     = 4.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    FORMAT INVERSE ON COLOR 6.
    WRITE: / 'lo_client_acct-&amp;gt;receive'. FORMAT COLOR OFF INVERSE OFF.
  ENDIF.

*   get status of the response
  CALL METHOD lo_client_acct-&amp;gt;response-&amp;gt;get_status
    IMPORTING
      code   = lv_httpcode
      reason = lv_reason.

ENDIF.&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Maybe is should change the "Content-Encoding" header to something different?&lt;/P&gt;&lt;P&gt;If I use &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;lo_client_acct-&amp;gt;request-&amp;gt;set_data( 'data' ). "binary
*insted of
lo_client_acct-&amp;gt;request-&amp;gt;set_cdata( 'data' ). "string&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The ";charset=utf-8" string on my Content-Type header disapears but i cant send the data as binary which ist intended in this method.&lt;/P&gt;&lt;P&gt;If I use an empty body, SAP sets the Content-Type correctly but when i put some characters in it immediately sets the charset value in the same field.&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Robin&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 12:49:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaa-p/12324908#M4617246</guid>
      <dc:creator>robin_k</dc:creator>
      <dc:date>2021-03-05T12:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot send HTTP Content-Type header without charset value</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaa-p/12324909#M4617247</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm running in the same problems &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Did anyone find a solution for this? Running cUrl as command is no proper solution I think &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;P&gt;Meex&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 06:24:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaa-p/12324909#M4617247</guid>
      <dc:creator>markus_reich</dc:creator>
      <dc:date>2023-09-18T06:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot send HTTP Content-Type header without charset value</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaa-p/12324910#M4617248</link>
      <description>&lt;P&gt;Hi Markus,&lt;/P&gt;&lt;P&gt;I do not remember all the details, but using the SET_DATA method instead of the SET_CDATA method solved it for me.&lt;/P&gt;&lt;P&gt;As far as i remeber I didn't even need to convert the data to binary.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 06:48:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaa-p/12324910#M4617248</guid>
      <dc:creator>robin_k</dc:creator>
      <dc:date>2023-09-18T06:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot send HTTP Content-Type header without charset value</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaa-p/12324911#M4617249</link>
      <description>&lt;P&gt;Hi Robin,&lt;/P&gt;&lt;P&gt;set_data requires as xstring, converting my string to xstring results in an error from API site as they don't accept binary content postings &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Meex&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 06:56:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaa-p/12324911#M4617249</guid>
      <dc:creator>markus_reich</dc:creator>
      <dc:date>2023-09-18T06:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot send HTTP Content-Type header without charset...</title>
      <link>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaa-p/13962275#M4896052</link>
      <description>&lt;P&gt;To avoid charset=UTF-8&lt;BR /&gt;&lt;BR /&gt;I am referencing variables from your code for you to better understand, just add below code&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;lo_client_acct-&amp;gt;request-&amp;gt;suppress_charset ( supress = abap_true ).&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ajinkya Chothave&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2024 17:35:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cannot-send-http-content-type-header-without-charset-value/qaa-p/13962275#M4896052</guid>
      <dc:creator>ajinkyachothave-1</dc:creator>
      <dc:date>2024-12-12T17:35:21Z</dc:date>
    </item>
  </channel>
</rss>

