<?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: Calling https web service POST method from ABAP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541723#M577647</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Wouter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm facing a similar issue. Can you explain me a little bit more how&amp;nbsp; &lt;STRONG&gt;wf_string&lt;/STRONG&gt; and &lt;STRONG&gt;host&lt;/STRONG&gt; have to poputate ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a nice day.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Jun 2015 18:27:40 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2015-06-19T18:27:40Z</dc:date>
    <item>
      <title>Calling https web service POST method from ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541717#M577641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having some problems trying to call a credit card https web service from ABAP on 2004s SP11. I'm not using a proxy server and a call from a test https page on my local machine works fine. The page does not require a certificate. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do I need to do anything in particular to make https work ? I've done calls to http services without any problems. The only difference from a programming perspective as far as I know is the scheme 2 instead of 1, and the server protocol changed to HTTPS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All is fine until  I call method http_client-&amp;gt;receive, at that point I get a return code of 1, http_communication_failure.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your suggestions &amp;amp; contributions will be greatly appreciated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Wouter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
report zcreditcardtest .

data: wf_user type string .
data: wf_password type string .

data: rlength type i,
      txlen type string  .

data: http_client type ref to if_http_client .

data: wf_string type string .
data: wf_string1 type string .

data: wf_proxy type string ,
      wf_port type string .

selection-screen: begin of block a with frame .
parameters: crcard(16) type c lower case default '4242424242424242',
            cvn(4)     type c lower case default '564',
            year(2)    type c lower case default '07',
            month(2)   type c lower case default '11',
            amount(10) type c lower case default '100.00',
            cukey(4)   type c lower case default 'AUD',
            order(10)  type c lower case default 'AB1322-refund'.

selection-screen skip 1.
parameters: user(50) lower case,
            password(50) lower case ,
            p_proxy(100) lower case default '' ,
            p_port(4) default ''.

selection-screen: end of block a .

at selection-screen output.

  loop at screen.
    if screen-name = 'PASSWORD'.
      screen-invisible = '1'.
      modify screen.
    endif.
  endloop.

start-of-selection .


  clear wf_string .

  concatenate

  'order.type=capture&amp;amp;customer.username=SOMEUSER'
  '&amp;amp;customer.password=SOMEPASSWORD'
  '&amp;amp;customer.merchant=SOMEMERCHANT'
  '&amp;amp;card.PAN=' crcard
  '&amp;amp;card.CVN=' cvn
  '&amp;amp;card.expiryYear=' year
  '&amp;amp;card.expiryMonth=' month
  '&amp;amp;order.amount=' amount
  '&amp;amp;customer.orderNumber=' order
  '&amp;amp;card.currency=' cukey
  '&amp;amp;order.ECI=IVR'
  '&amp;amp;customer.captureOrderNumber=' order
  '&amp;amp;order.priority=1'
  '&amp;amp;message.end=null'

  into wf_string .

  break-point.

  clear :rlength , txlen .
  rlength = strlen( wf_string ) .
  move: rlength to txlen .

  clear: wf_proxy, wf_port .

  move: p_proxy to wf_proxy ,
        p_port to wf_port .

  call method cl_http_client=&amp;gt;create
    exporting
      host          = 'api.somewhere.com'
      service       = '80'
      scheme        = '2'                        "https
      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 .

* proxy server authentication
  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 = 'HTTPS/1.0'.

  call method http_client-&amp;gt;request-&amp;gt;set_header_field
    exporting
      name  = '~request_uri'
      value = '/post/CreditCardAPIReceiver'.

  call method http_client-&amp;gt;request-&amp;gt;set_header_field
    exporting
      name  = 'Content-Type'
      value = 'application/x-www-form-urlencoded; charset=UTF-8'.

  call method http_client-&amp;gt;request-&amp;gt;set_header_field
    exporting
      name  = 'Content-Length'
      value = txlen.

  call method http_client-&amp;gt;request-&amp;gt;set_header_field
    exporting
      name  = 'HOST'
      value = 'api.somewhere.com:80'.

  call method http_client-&amp;gt;request-&amp;gt;set_cdata
    exporting
      data   = wf_string
      offset = 0
      length = rlength.

  call method http_client-&amp;gt;send
    exceptions
      http_communication_failure = 1
      http_invalid_state         = 2.

  call method http_client-&amp;gt;receive
    exceptions
      http_communication_failure = 1
      http_invalid_state         = 2
      http_processing_failed     = 3.

  if sy-subrc &amp;lt;&amp;gt; 0.
    message e000(oo) with 'Processing failed !'.
  endif.

  clear wf_string1 .

  wf_string1 = http_client-&amp;gt;response-&amp;gt;get_cdata( ).

* Further Processing of returned values would go here.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2007 01:07:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541717#M577641</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-16T01:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calling https web service POST method from ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541718#M577642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A little more information for my question, I'm trying to achieve the following POST :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
POST /post/CreditCardAPIReceiver HTTPS/1.0
Content-type: application/x-www-form-urlencoded; charset=&amp;#148;UTF-8&amp;#148;
Content-length: 315
Host: api.somewhere.com:80

order.type=capture&amp;amp;customer.username=COMPANYA&amp;amp;customer.pas
sword=insurance&amp;amp;customer.merchant=companya&amp;amp;card.PAN=424242
4242424242&amp;amp;card.CVN=564&amp;amp;card.expiryYear=10&amp;amp;card.expiryMont
h=06&amp;amp;order.amount=3400&amp;amp;customer.orderNumber=AB1322refund&amp;amp;c
ard.currency=AUD&amp;amp;order.ECI=IVR&amp;amp;customer.captureOrderNumber
=AB1322&amp;amp;order.priority=1&amp;amp;message.end=null
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Host name has been changed for security purposes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2007 02:31:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541718#M577642</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-16T02:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calling https web service POST method from ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541719#M577643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not used HTTPS post, but in a test program I used for HTTP I note there is a '~request_protocol' header field (value "HTTP/1.0"). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also try the following after the send / receive that fails to get extra details&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD http_client-&amp;gt;get_last_error&lt;/P&gt;&lt;P&gt;     IMPORTING&lt;/P&gt;&lt;P&gt;       message = my_message.    "type string&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2007 04:17:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541719#M577643</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-16T04:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calling https web service POST method from ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541720#M577644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the tips, no luck unfortunately. The last message as suggested is blank...  I believe this has something to do with certificates and trusted systems. I've seen some posts on using RFC destinations instead of going straight out, I might have a look at that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately this is new to me so I will have to keep digging... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks anyway,&lt;/P&gt;&lt;P&gt;Wouter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2007 08:27:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541720#M577644</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-16T08:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calling https web service POST method from ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541721#M577645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, finally got this running ! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all I needed to download SAP Cryptographic Software and install it on the Web Application Server. Added some parameters to the profile, then set up some nodes in strust. Note 510007 describes the full process. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then installed the certifcate I needed by opening the website in internet explorer and exporting it to a CER file and then importing it into the SSL client (Anonymous). The blog from Thomas Yung, "BSP a Developer's Journal Part XIV - Consuming WebServices with ABAP" describes the process of exporting and importing certificates. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then had to start the HTTPS service on my NW 2004s ABAP preview edition SP11. I set this up for port 443. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/osmicm --&amp;gt; GOTO --&amp;gt; SERVICES --&amp;gt; SERVICE --&amp;gt; CREATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then finally, the program needed a few changes :&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          = 'api.somewhere.com'
      service       = '443'                       " &amp;lt;&amp;lt;-----  443 NOT 80
      scheme        = '2'                        "https
      ssl_id        = 'ANONYM'              " &amp;lt;&amp;lt;----- SSL_ID Added
      proxy_host    = wf_proxy
      proxy_service = wf_port
    importing
      client        = http_client.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and further in the program (thanks Andrew !) :&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  = '~server_protocol'             " &amp;lt;&amp;lt;&amp;lt;--- DELETE
      name  = '~request_protocol'         " &amp;lt;&amp;lt;&amp;lt;-- INSERT must be request
      value = 'HTTPS/1.0'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and presto, we can now consume a https webservice via a POST method from within an ABAP program ! Nice.... Can I give myself 10 points ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2007 14:32:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541721#M577645</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-16T14:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calling https web service POST method from ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541722#M577646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Wouter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks alot for directing me to Thomas Jung's &lt;A __default_attr="39856" __jive_macro_name="blogpost" class="jive_macro jive_macro_blogpost" href="https://community.sap.com/"&gt;&lt;/A&gt; and also for posting how to fix the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are awesome!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Sep 2013 07:02:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541722#M577646</guid>
      <dc:creator>former_member191562</dc:creator>
      <dc:date>2013-09-16T07:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calling https web service POST method from ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541723#M577647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Wouter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm facing a similar issue. Can you explain me a little bit more how&amp;nbsp; &lt;STRONG&gt;wf_string&lt;/STRONG&gt; and &lt;STRONG&gt;host&lt;/STRONG&gt; have to poputate ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a nice day.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2015 18:27:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541723#M577647</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-06-19T18:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calling https web service POST method from ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541724#M577648</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;an additional question:&lt;/P&gt;&lt;P&gt;Variable "wf_string" which will be POSTED In this example. &lt;/P&gt;&lt;P&gt;Does this "wf_string" has a limit? &lt;/P&gt;&lt;P&gt;If yes, what is the maximal length for the POST-request?&lt;/P&gt;&lt;P&gt;thanks Joachim&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 16:17:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-https-web-service-post-method-from-abap/m-p/2541724#M577648</guid>
      <dc:creator>former_member402310</dc:creator>
      <dc:date>2020-02-14T16:17:44Z</dc:date>
    </item>
  </channel>
</rss>

