<?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: Content-Type for POST request in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/content-type-for-post-request/m-p/1598268#M268633</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; It didn't work. As best as I can figure it it seems that http_client-&amp;gt;request-&amp;gt;set_header_field only allows certain fields to be set or they are overwritten at send time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example ~request_uri and Content-Type seemed to be ignored while ~request_method does seem to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be nice if there was some documentation for this &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Allan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Oct 2006 02:37:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-10-19T02:37:24Z</dc:date>
    <item>
      <title>Content-Type for POST request</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/content-type-for-post-request/m-p/1598264#M268629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am setting content-type in the header to "text/xml"  yet when I do a POST sap sends as content-type &lt;/P&gt;&lt;P&gt;"application/x-www-form-urlencoded". Is there something else I need to set to make it post with text/xml ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  cl_http_client=&amp;gt;create_by_url( EXPORTING url = url
                                           ssl_id = 'ANONYM'
                                 IMPORTING client = http_client ).
* create HTTP client object
*  cl_http_client=&amp;gt;create_by_destination( EXPORTING DESTINATION = 'ZTOLLREQUEST'
*                                 IMPORTING client = http_client ).
                                                                                * Set HTTP headers
  http_client-&amp;gt;request-&amp;gt;set_header_field( name = '~request_method'
  value = 'POST' ).
  http_client-&amp;gt;request-&amp;gt;set_header_field( name = 'Content-Type'
  value = 'text/xml' ).
*  http_client-&amp;gt;request-&amp;gt;set_header_field( name = 'Authorization'
*  value = auth_string ).
*  http_client-&amp;gt;request-&amp;gt;set_header_field( name = 'sap-password'
*  value = 'ymous' ).
                                                                                * Set payload
  http_client-&amp;gt;request-&amp;gt;set_cdata( xml_string ).
                                                                                * send and receive
  CALL METHOD http_client-&amp;gt;send
    EXCEPTIONS
      http_communication_failure = 1
      http_invalid_state         = 2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Allan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2006 05:58:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/content-type-for-post-request/m-p/1598264#M268629</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-18T05:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Content-Type for POST request</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/content-type-for-post-request/m-p/1598265#M268630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Allan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How did you find that SAP sends as "application/x-ww...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is what i use along with encoding and never had any problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;call method http_client-&amp;gt;request-&amp;gt;set_header_field
  exporting
    name  = 'Content-Type'
    value = 'text/xml; charset=utf-8'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2006 06:18:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/content-type-for-post-request/m-p/1598265#M268630</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-10-18T06:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: Content-Type for POST request</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/content-type-for-post-request/m-p/1598266#M268631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you again &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The response I am getting from the (other companies) server is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Invalid MediaType in ContentType, expected text/xml but got application/x-www-form-urlencoded
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I don't know any easy way of checking the outgoing headers to see if this is true.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried your code snipet with the charset and I still get the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Allan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2006 06:35:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/content-type-for-post-request/m-p/1598266#M268631</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-18T06:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Content-Type for POST request</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/content-type-for-post-request/m-p/1598267#M268632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i havent tried this (setting content type) when using create by url . may be try just the create method and then set the remaining part of the url as headers ~request_uri parameter. something like below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;call method cl_http_client=&amp;gt;create
  exporting
    host          = 'www.webservicex.net'
    service       = '80'
    scheme        = '1'
    proxy_host    =  wf_proxy
    proxy_service =  wf_port
  importing
    client        = http_client.

http_client-&amp;gt;propertytype_logon_popup = http_client-&amp;gt;co_disabled.

wf_user = user .
wf_password = password .

call method http_client-&amp;gt;authenticate
  exporting
    proxy_authentication = 'X'
    username             = wf_user
    password             = wf_password.


call method http_client-&amp;gt;request-&amp;gt;set_header_field
  exporting
    name  = '~request_method'
    value = 'POST'.

call method http_client-&amp;gt;request-&amp;gt;set_header_field
  exporting
    name  = '~server_protocol'
    value = 'HTTP/1.1'.

call method http_client-&amp;gt;request-&amp;gt;set_header_field
  exporting
    name  = '~request_uri'
    value = '/airport.asmx'.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2006 06:43:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/content-type-for-post-request/m-p/1598267#M268632</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-10-18T06:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Content-Type for POST request</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/content-type-for-post-request/m-p/1598268#M268633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; It didn't work. As best as I can figure it it seems that http_client-&amp;gt;request-&amp;gt;set_header_field only allows certain fields to be set or they are overwritten at send time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example ~request_uri and Content-Type seemed to be ignored while ~request_method does seem to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be nice if there was some documentation for this &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Allan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Oct 2006 02:37:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/content-type-for-post-request/m-p/1598268#M268633</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-19T02:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Content-Type for POST request</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/content-type-for-post-request/m-p/1598269#M268634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should mention the system is Netweaver 04, in case that makes a difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Allan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Oct 2006 02:39:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/content-type-for-post-request/m-p/1598269#M268634</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-19T02:39:53Z</dc:date>
    </item>
  </channel>
</rss>

