<?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 Re: Unable to post json data to web service API through POST method - MULTIPART/FORM-DATA in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/unable-to-post-json-data-to-web-service-api-through-post-method-multipart/m-p/808910#M41597</link>
    <description>&lt;P&gt;Hi praveen, &lt;/P&gt;&lt;P&gt;I am also trying to do the same thing. Can you please let me know the steps involved. &lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2019 10:09:10 GMT</pubDate>
    <dc:creator>kjyothiraditya</dc:creator>
    <dc:date>2019-06-07T10:09:10Z</dc:date>
    <item>
      <title>Unable to post json data to web service API through POST method - MULTIPART/FORM-DATA</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unable-to-post-json-data-to-web-service-api-through-post-method-multipart/m-p/808908#M41595</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
  &lt;P&gt;i am trying to Post Json format data to other application using Webservice Call.&lt;/P&gt;
  &lt;P&gt;1. get Token&lt;/P&gt;
  &lt;P&gt;2. Based on token need to post data.&lt;/P&gt;
  &lt;P&gt; i am able to get the token and also able to post using that.&lt;/P&gt;
  &lt;P&gt;here the problem is My response after posting data is 200 &amp;amp; (success : TRUE)&lt;/P&gt;
  &lt;P&gt;But when i went and see the application only file is appearing not the data.&lt;/P&gt;
  &lt;P&gt;If i do the same thing using Post Man , i can see data there. &lt;/P&gt;
  &lt;P&gt;Here is my code snippet,&lt;/P&gt;
  &lt;P&gt;Plesae suggest something....&lt;/P&gt;
  &lt;P&gt;data : lv_url type string value 'https://XXXXXXXXXX?transformation=JSON Ewaybill (Standard)-1.03'.&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt; cl_http_client=&amp;gt;create_by_url(&lt;BR /&gt; exporting&lt;BR /&gt; url = lv_url " Logical destination (specified in function call)&lt;BR /&gt; importing&lt;BR /&gt; client = l_http_client " HTTP Client Abstraction&lt;BR /&gt; exceptions&lt;BR /&gt; argument_not_found = 1&lt;BR /&gt; plugin_not_active = 2&lt;BR /&gt; internal_error = 3&lt;BR /&gt; others = 4&lt;BR /&gt; ).&lt;BR /&gt; &lt;BR /&gt;l_http_client-&amp;gt;request-&amp;gt;set_method( if_http_request=&amp;gt;co_request_method_post ).&lt;BR /&gt; l_http_client-&amp;gt;request-&amp;gt;set_version( if_http_request=&amp;gt;co_protocol_version_1_1 ).&lt;BR /&gt;&lt;BR /&gt; call method l_http_client-&amp;gt;request-&amp;gt;set_header_field&lt;BR /&gt; exporting&lt;BR /&gt; name = 'HOST'&lt;BR /&gt; value = 'live.encomply.com'.&lt;BR /&gt; &lt;BR /&gt; call method l_http_client-&amp;gt;request-&amp;gt;set_header_field&lt;BR /&gt; exporting&lt;BR /&gt; name = 'Authorization'&lt;BR /&gt; value = ls_tkn_v.&lt;BR /&gt; &lt;BR /&gt; call method l_http_client-&amp;gt;request-&amp;gt;set_header_field&lt;BR /&gt; exporting&lt;BR /&gt; name = 'app-id'&lt;BR /&gt; value = 'envoice'.&lt;BR /&gt; &lt;BR /&gt; call method l_http_client-&amp;gt;request-&amp;gt;set_content_type&lt;BR /&gt; exporting&lt;BR /&gt; content_type = 'multipart/form-data'.&lt;BR /&gt;&lt;BR /&gt; *********************************Body&lt;BR /&gt; multipart = l_http_client-&amp;gt;request-&amp;gt;add_multipart( ).&lt;BR /&gt; &lt;BR /&gt; multipart-&amp;gt;set_header_field(&lt;BR /&gt; name = if_http_header_fields=&amp;gt;content_disposition&lt;BR /&gt; value = 'form-data; name="transformation"'&lt;BR /&gt; ).&lt;BR /&gt; &lt;BR /&gt; * multipart-&amp;gt;suppress_content_type( ).&lt;BR /&gt; &lt;BR /&gt; multipart-&amp;gt;set_cdata(&lt;BR /&gt; data = 'JSON Ewaybill (Standard)-1.03'&lt;BR /&gt; ).&lt;BR /&gt; &lt;BR /&gt; multipart = l_http_client-&amp;gt;request-&amp;gt;add_multipart( ).&lt;BR /&gt; &lt;BR /&gt; g_file1_cont = jsondata. "contains data in json format&lt;BR /&gt; &lt;BR /&gt; vari = 'form-data; name="E-waybill-Json"; filename="'.&lt;BR /&gt; concatenate vari ex '"' into name.&lt;BR /&gt; &lt;BR /&gt; g_file1_form_data = name .&lt;BR /&gt; &lt;BR /&gt; multipart-&amp;gt;set_header_field(&lt;BR /&gt; name = if_http_header_fields=&amp;gt;content_disposition&lt;BR /&gt; value = g_file1_form_data&lt;BR /&gt; ).&lt;BR /&gt; &lt;BR /&gt; multipart-&amp;gt;set_content_type( 'application/json' ).&lt;BR /&gt; &lt;BR /&gt; multipart = l_http_client-&amp;gt;request-&amp;gt;add_multipart( ).&lt;BR /&gt; &lt;BR /&gt; lv_len = strlen( jsondata ).&lt;BR /&gt; &lt;BR /&gt; multipart-&amp;gt;set_cdata(&lt;BR /&gt; data = g_file1_cont&lt;BR /&gt; offset = 0&lt;BR /&gt; length = lv_len ). "01|XXXXXXXXXXX.... sep: cl_abap_char_utilities=&amp;gt;cr_lf&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; "STEP-4 : SEND HTTP REQUEST&lt;BR /&gt; call method l_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; &lt;BR /&gt; "STEP-5 : GET HTTP RESPONSE&lt;BR /&gt; call method l_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; &lt;BR /&gt; "STEP-6 : Read HTTP RETURN CODE&lt;BR /&gt; call method l_http_client-&amp;gt;response-&amp;gt;get_status&lt;BR /&gt; importing&lt;BR /&gt; code = l_http_status_code&lt;BR /&gt; reason = l_status_text.&lt;BR /&gt; &lt;BR /&gt; data lv_result2 type string.&lt;BR /&gt; &lt;BR /&gt; lv_result2 = l_http_client-&amp;gt;response-&amp;gt;get_cdata( ).&lt;/P&gt;
  &lt;P&gt;Please hep me...&lt;/P&gt;
  &lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 08:11:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unable-to-post-json-data-to-web-service-api-through-post-method-multipart/m-p/808908#M41595</guid>
      <dc:creator>former_member581061</dc:creator>
      <dc:date>2019-02-04T08:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to post json data to web service API through POST method - MULTIPART/FORM-DATA</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unable-to-post-json-data-to-web-service-api-through-post-method-multipart/m-p/808909#M41596</link>
      <description>&lt;P&gt;Solved.&lt;/P&gt;&lt;P&gt;When i send data to application it is receiving as charset/utf-8( i am not setting it ) which application won't supports,so they have added that functionality now the application can able to load the data.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2019 10:45:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unable-to-post-json-data-to-web-service-api-through-post-method-multipart/m-p/808909#M41596</guid>
      <dc:creator>former_member581061</dc:creator>
      <dc:date>2019-04-01T10:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to post json data to web service API through POST method - MULTIPART/FORM-DATA</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unable-to-post-json-data-to-web-service-api-through-post-method-multipart/m-p/808910#M41597</link>
      <description>&lt;P&gt;Hi praveen, &lt;/P&gt;&lt;P&gt;I am also trying to do the same thing. Can you please let me know the steps involved. &lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2019 10:09:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unable-to-post-json-data-to-web-service-api-through-post-method-multipart/m-p/808910#M41597</guid>
      <dc:creator>kjyothiraditya</dc:creator>
      <dc:date>2019-06-07T10:09:10Z</dc:date>
    </item>
  </channel>
</rss>

