<?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>topic Status 415 HTTP - XML in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631205#M26486</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;I am getting an error "The server refused this request because the request entity is in a format not supported by the requested resource for the requested method." while I send a XML file to a API.&lt;/P&gt;
  &lt;P&gt;My code:&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt; CALL METHOD cl_http_client=&amp;gt;create_by_destination&lt;BR /&gt; EXPORTING&lt;BR /&gt; destination = 'INTEGRATION'&lt;BR /&gt; IMPORTING&lt;BR /&gt; client = http_client&lt;BR /&gt; EXCEPTIONS&lt;BR /&gt; argument_not_found = 1&lt;BR /&gt; destination_not_found = 2&lt;BR /&gt; destination_no_authority = 3&lt;BR /&gt; plugin_not_active = 4&lt;BR /&gt; internal_error = 5&lt;BR /&gt; OTHERS = 6.&lt;BR /&gt; IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;
  &lt;P&gt; ENDIF.&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt; CALL METHOD http_client-&amp;gt;request-&amp;gt;set_header_field&lt;BR /&gt; EXPORTING&lt;BR /&gt; name = '~request_method'&lt;BR /&gt; value = 'POST'.&lt;/P&gt;
  &lt;P&gt; CALL METHOD http_client-&amp;gt;request-&amp;gt;set_header_field&lt;BR /&gt; EXPORTING&lt;BR /&gt; name = 'Content-Type'&lt;BR /&gt; value = 'text/xml; charset=utf-8'.&lt;/P&gt;
  &lt;P&gt; CALL METHOD http_client-&amp;gt;request-&amp;gt;set_cdata&lt;BR /&gt; EXPORTING&lt;BR /&gt; data = wf_string&lt;BR /&gt; offset = 0&lt;BR /&gt; length = rlength.&lt;/P&gt;
  &lt;P&gt; CALL METHOD http_client-&amp;gt;send&lt;BR /&gt; EXCEPTIONS&lt;BR /&gt; http_communication_failure = 1&lt;BR /&gt; http_invalid_state = 2&lt;BR /&gt; http_processing_failed = 3&lt;BR /&gt; OTHERS = 4.&lt;/P&gt;
  &lt;P&gt; CALL METHOD http_client-&amp;gt;receive&lt;BR /&gt; EXCEPTIONS&lt;BR /&gt; http_communication_failure = 1&lt;BR /&gt; http_invalid_state = 2&lt;BR /&gt; http_processing_failed = 3&lt;BR /&gt; OTHERS = 4.&lt;/P&gt;
  &lt;P&gt; wf_string1 = http_client-&amp;gt;response-&amp;gt;get_cdata( ).&lt;/P&gt;
  &lt;P&gt;My XML file is:&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;CLEAR wf_string.&lt;BR /&gt; CONCATENATE wf_string&lt;BR /&gt; '&amp;lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&amp;gt;'&lt;BR /&gt; '&amp;lt;EIC_MarketDocument&amp;gt;'&lt;BR /&gt; '&amp;lt;mRID&amp;gt;' '1117' '&amp;lt;/mRID&amp;gt;'&lt;BR /&gt; '&amp;lt;type&amp;gt;' 'B03' '&amp;lt;/type&amp;gt;'&lt;BR /&gt; '&amp;lt;sender_MarketParticipant.marketRole.type&amp;gt;' 'A42' '&amp;lt;/sender_MarketParticipant.marketRole.type&amp;gt;'&lt;BR /&gt; '&amp;lt;sender_MarketParticipant.mRID CodingScheme = "A01"&amp;gt;' '17V' '&amp;lt;/sender_MarketParticipant.mRID&amp;gt;'&lt;BR /&gt; '&amp;lt;receiver_MarketParticipant.marketRole.type&amp;gt;' 'A40' '&amp;lt;/receiver_MarketParticipant.marketRole.type&amp;gt;'&lt;BR /&gt; '&amp;lt;receiver_MarketParticipant.mRID CodingScheme = "A01"&amp;gt;' '17' '&amp;lt;/receiver_MarketParticipant.mRID&amp;gt;'&lt;BR /&gt; '&amp;lt;revisionNumber&amp;gt;' '1' '&amp;lt;/revisionNumber&amp;gt;'&lt;BR /&gt; '&amp;lt;createdDateTime&amp;gt;' '2016-07-06T16:32:38Z' '&amp;lt;/createdDateTime&amp;gt;'&lt;/P&gt;
  &lt;P&gt; '&amp;lt;EICCode_MarketDocument&amp;gt;'&lt;BR /&gt; '&amp;lt;long_Names.name&amp;gt;' 'FR_517320' '&amp;lt;/long_Names.name&amp;gt;'&lt;BR /&gt; '&amp;lt;display_Names.name&amp;gt;' 'FR_517320' '&amp;lt;/display_Names.name&amp;gt;'&lt;/P&gt;
  &lt;P&gt; '&amp;lt;status&amp;gt; &amp;lt;value&amp;gt;A14&amp;lt;/value&amp;gt; &amp;lt;/status&amp;gt;'&lt;BR /&gt; '&amp;lt;attributeInstanceComponent.attribute&amp;gt;' 'Local' '&amp;lt;/attributeInstanceComponent.attribute&amp;gt;'&lt;/P&gt;
  &lt;P&gt; '&amp;lt;lastRequest_DateAndOrTime.date&amp;gt;' '2018-02-12' '&amp;lt;/lastRequest_DateAndOrTime.date&amp;gt;'&lt;/P&gt;
  &lt;P&gt; '&amp;lt;eICCode_MarketParticipant.aCERCode_Names.name&amp;gt;' '' '&amp;lt;/eICCode_MarketParticipant.aCERCode_Names.name&amp;gt;'&lt;BR /&gt; '&amp;lt;eICCode_MarketParticipant.vATCode_Names.name&amp;gt;' '' '&amp;lt;/eICCode_MarketParticipant.vATCode_Names.name&amp;gt;'&lt;BR /&gt; '&amp;lt;eICParent_MarketDocument.mRID&amp;gt;' '' '&amp;lt;/eICParent_MarketDocument.mRID&amp;gt;'&lt;BR /&gt; '&amp;lt;/EICCode_MarketDocument&amp;gt;'&lt;BR /&gt; '&amp;lt;/EIC_MarketDocument&amp;gt;'&lt;BR /&gt; INTO wf_string .&lt;/P&gt;
  &lt;P&gt;Connexion test:&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/110961-test-con.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;I don't know where is the problem, I did this exactly like others examples in forums.&lt;/P&gt;
  &lt;P&gt;Thanks you very much for your help!&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2018 17:51:17 GMT</pubDate>
    <dc:creator>former_member496638</dc:creator>
    <dc:date>2018-02-13T17:51:17Z</dc:date>
    <item>
      <title>Status 415 HTTP - XML</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631205#M26486</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;I am getting an error "The server refused this request because the request entity is in a format not supported by the requested resource for the requested method." while I send a XML file to a API.&lt;/P&gt;
  &lt;P&gt;My code:&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt; CALL METHOD cl_http_client=&amp;gt;create_by_destination&lt;BR /&gt; EXPORTING&lt;BR /&gt; destination = 'INTEGRATION'&lt;BR /&gt; IMPORTING&lt;BR /&gt; client = http_client&lt;BR /&gt; EXCEPTIONS&lt;BR /&gt; argument_not_found = 1&lt;BR /&gt; destination_not_found = 2&lt;BR /&gt; destination_no_authority = 3&lt;BR /&gt; plugin_not_active = 4&lt;BR /&gt; internal_error = 5&lt;BR /&gt; OTHERS = 6.&lt;BR /&gt; IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;
  &lt;P&gt; ENDIF.&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt; CALL METHOD http_client-&amp;gt;request-&amp;gt;set_header_field&lt;BR /&gt; EXPORTING&lt;BR /&gt; name = '~request_method'&lt;BR /&gt; value = 'POST'.&lt;/P&gt;
  &lt;P&gt; CALL METHOD http_client-&amp;gt;request-&amp;gt;set_header_field&lt;BR /&gt; EXPORTING&lt;BR /&gt; name = 'Content-Type'&lt;BR /&gt; value = 'text/xml; charset=utf-8'.&lt;/P&gt;
  &lt;P&gt; CALL METHOD http_client-&amp;gt;request-&amp;gt;set_cdata&lt;BR /&gt; EXPORTING&lt;BR /&gt; data = wf_string&lt;BR /&gt; offset = 0&lt;BR /&gt; length = rlength.&lt;/P&gt;
  &lt;P&gt; CALL METHOD http_client-&amp;gt;send&lt;BR /&gt; EXCEPTIONS&lt;BR /&gt; http_communication_failure = 1&lt;BR /&gt; http_invalid_state = 2&lt;BR /&gt; http_processing_failed = 3&lt;BR /&gt; OTHERS = 4.&lt;/P&gt;
  &lt;P&gt; CALL METHOD http_client-&amp;gt;receive&lt;BR /&gt; EXCEPTIONS&lt;BR /&gt; http_communication_failure = 1&lt;BR /&gt; http_invalid_state = 2&lt;BR /&gt; http_processing_failed = 3&lt;BR /&gt; OTHERS = 4.&lt;/P&gt;
  &lt;P&gt; wf_string1 = http_client-&amp;gt;response-&amp;gt;get_cdata( ).&lt;/P&gt;
  &lt;P&gt;My XML file is:&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;CLEAR wf_string.&lt;BR /&gt; CONCATENATE wf_string&lt;BR /&gt; '&amp;lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&amp;gt;'&lt;BR /&gt; '&amp;lt;EIC_MarketDocument&amp;gt;'&lt;BR /&gt; '&amp;lt;mRID&amp;gt;' '1117' '&amp;lt;/mRID&amp;gt;'&lt;BR /&gt; '&amp;lt;type&amp;gt;' 'B03' '&amp;lt;/type&amp;gt;'&lt;BR /&gt; '&amp;lt;sender_MarketParticipant.marketRole.type&amp;gt;' 'A42' '&amp;lt;/sender_MarketParticipant.marketRole.type&amp;gt;'&lt;BR /&gt; '&amp;lt;sender_MarketParticipant.mRID CodingScheme = "A01"&amp;gt;' '17V' '&amp;lt;/sender_MarketParticipant.mRID&amp;gt;'&lt;BR /&gt; '&amp;lt;receiver_MarketParticipant.marketRole.type&amp;gt;' 'A40' '&amp;lt;/receiver_MarketParticipant.marketRole.type&amp;gt;'&lt;BR /&gt; '&amp;lt;receiver_MarketParticipant.mRID CodingScheme = "A01"&amp;gt;' '17' '&amp;lt;/receiver_MarketParticipant.mRID&amp;gt;'&lt;BR /&gt; '&amp;lt;revisionNumber&amp;gt;' '1' '&amp;lt;/revisionNumber&amp;gt;'&lt;BR /&gt; '&amp;lt;createdDateTime&amp;gt;' '2016-07-06T16:32:38Z' '&amp;lt;/createdDateTime&amp;gt;'&lt;/P&gt;
  &lt;P&gt; '&amp;lt;EICCode_MarketDocument&amp;gt;'&lt;BR /&gt; '&amp;lt;long_Names.name&amp;gt;' 'FR_517320' '&amp;lt;/long_Names.name&amp;gt;'&lt;BR /&gt; '&amp;lt;display_Names.name&amp;gt;' 'FR_517320' '&amp;lt;/display_Names.name&amp;gt;'&lt;/P&gt;
  &lt;P&gt; '&amp;lt;status&amp;gt; &amp;lt;value&amp;gt;A14&amp;lt;/value&amp;gt; &amp;lt;/status&amp;gt;'&lt;BR /&gt; '&amp;lt;attributeInstanceComponent.attribute&amp;gt;' 'Local' '&amp;lt;/attributeInstanceComponent.attribute&amp;gt;'&lt;/P&gt;
  &lt;P&gt; '&amp;lt;lastRequest_DateAndOrTime.date&amp;gt;' '2018-02-12' '&amp;lt;/lastRequest_DateAndOrTime.date&amp;gt;'&lt;/P&gt;
  &lt;P&gt; '&amp;lt;eICCode_MarketParticipant.aCERCode_Names.name&amp;gt;' '' '&amp;lt;/eICCode_MarketParticipant.aCERCode_Names.name&amp;gt;'&lt;BR /&gt; '&amp;lt;eICCode_MarketParticipant.vATCode_Names.name&amp;gt;' '' '&amp;lt;/eICCode_MarketParticipant.vATCode_Names.name&amp;gt;'&lt;BR /&gt; '&amp;lt;eICParent_MarketDocument.mRID&amp;gt;' '' '&amp;lt;/eICParent_MarketDocument.mRID&amp;gt;'&lt;BR /&gt; '&amp;lt;/EICCode_MarketDocument&amp;gt;'&lt;BR /&gt; '&amp;lt;/EIC_MarketDocument&amp;gt;'&lt;BR /&gt; INTO wf_string .&lt;/P&gt;
  &lt;P&gt;Connexion test:&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/110961-test-con.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;I don't know where is the problem, I did this exactly like others examples in forums.&lt;/P&gt;
  &lt;P&gt;Thanks you very much for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 17:51:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631205#M26486</guid>
      <dc:creator>former_member496638</dc:creator>
      <dc:date>2018-02-13T17:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Status 415 HTTP - XML</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631206#M26487</link>
      <description>&lt;P&gt;Parameter LENGTH in method SET_CDATA is optional and has default value -1 (automatic length determination).&lt;/P&gt;
  &lt;P&gt;You send an empty request body with length = 0 in your code. This is interpreted from server as http error 415.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;CALL METHOD http_client-&amp;gt;request-&amp;gt;set_cdata
 EXPORTING
 data = wf_string
 offset = 0
 length = rlength.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Feb 2018 19:09:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631206#M26487</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-02-13T19:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Status 415 HTTP - XML</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631207#M26488</link>
      <description>&lt;P&gt;&lt;/P&gt;
  &lt;P&gt;It didn't work, I have the same message &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 10:00:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631207#M26488</guid>
      <dc:creator>former_member496638</dc:creator>
      <dc:date>2018-02-14T10:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Status 415 HTTP - XML</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631208#M26489</link>
      <description>&lt;P&gt;I think the problem was "value = 'text/xml; charset=utf-8'." I changed it by "value = 'application/xml'." and I'am connected.&lt;/P&gt;
  &lt;P&gt;But, now I have a different error message: "424 Failed Dependency". Is it also a problem SAP or something in the API?&lt;/P&gt;
  &lt;P&gt;Thanks for your help.&lt;/P&gt;
  &lt;P&gt;Fernando&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 11:02:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631208#M26489</guid>
      <dc:creator>former_member496638</dc:creator>
      <dc:date>2018-02-14T11:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Status 415 HTTP - XML</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631209#M26490</link>
      <description>&lt;P&gt;It was a format problem of XML fichier.&lt;/P&gt;
  &lt;P&gt;Closed.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 14:00:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631209#M26490</guid>
      <dc:creator>former_member496638</dc:creator>
      <dc:date>2018-02-14T14:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: Status 415 HTTP - XML</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631210#M26491</link>
      <description>&lt;P&gt;&lt;STRONG&gt;EDIT my answer is probably completely wrong, cf comment by Tibor below.&lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;In your screen shot, the error is 405 "method not allowed", and only POST is allowed (allow=POST). It means that the way you "say" POST is incorrect:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;CALL METHOD http_client-&amp;gt;request-&amp;gt;set_header_field EXPORTING name = '~request_method' value = 'POST'.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Instead, use:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;http_client-&amp;gt;request-&amp;gt;set_method( if_http_request=&amp;gt;co_request_method_post ).&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;PS: you made a confusion between the true HTTP request method and the SAP "pseudo-header field" ~request_method. The latter is derived automatically from the HTTP request header fields when an incoming HTTP request arrives at SAP. It's used to simplify the processing of the request by the ICF request handler.&lt;/P&gt;
  &lt;P&gt;PS: I don't understand why you said it was an XML problem (in the request body).&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 22:38:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631210#M26491</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2018-02-14T22:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Status 415 HTTP - XML</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631211#M26492</link>
      <description>&lt;P&gt;The original error from question title is "&lt;STRONG&gt;415&lt;/STRONG&gt; Unsupported Media Type".&lt;/P&gt;
  &lt;P&gt;The screenshot shows connection test from SM59 and there error message "&lt;STRONG&gt;405&lt;/STRONG&gt; Method not allowed" is correct, because SM59 connection test does not sent a POST request. HTTP error code 405 was not created by the posted source code.&lt;/P&gt;
  &lt;P&gt;Fix to 415: text/xml -&amp;gt; application/xml&lt;/P&gt;
  &lt;P&gt;New error: "424 Failed Dependency" -&amp;gt; "It was a format problem of XML fichier. Closed"&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 23:07:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631211#M26492</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-02-14T23:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Status 415 HTTP - XML</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631212#M26493</link>
      <description>&lt;P&gt;Sorry, I didn't pay attention that the screenshot originated from SM59.&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;Thank you for the clarification. 424 is not clearly related to the "file format" though (wikipedia: the request failed because it depended on another request and that request failed (e.g., a PROPPATCH)).&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;So, my answer was completely wrong &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;I also probably made a mistake about set_header_field EXPORTING name='~request_method' value='POST'. It probably works with the same behavior as http_client-&amp;gt;request-&amp;gt;set_method( if_http_request=&amp;gt;co_request_method_post ).&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 08:05:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/status-415-http-xml/m-p/631212#M26493</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2018-02-15T08:05:47Z</dc:date>
    </item>
  </channel>
</rss>

