Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

https communication

Former Member
0 Likes
751

Hi Experts,

i have a requirement to transfer a XML file to Https server.

i have instaleed SSL certificate in SAP.

can u guide me ho to transfer this XML file to Https server using ABAP.

i searched in sdn.but stilll my problem was not solved.

Thanks

Sai

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
673

Hi sabu,

thank u for ur repl;y.but ithink it is only for https but not https

thanks

sai

4 REPLIES 4
Read only

Former Member
0 Likes
673

Sai,

Refer program RSHTTP20, if it helps you.

Regards

Sabu

Read only

Former Member
0 Likes
675

Hi sabu,

thank u for ur repl;y.but ithink it is only for https but not https

thanks

sai

Read only

0 Likes
673

Hi Sai,

I've the same requirement to post XML document into HTTPS serverf from ABAP. Have you managed to get this up and running ?

Thank you.

Regards,

Danny

Read only

0 Likes
673

Thomas Jung did a nice e-learning tutorial on SDN on HTTPS communication with Polestar. I have posted an example of HTTPS communication between Paypal's Payflow gateway and SAP on Paypal's developer forum as well. For XML, the only real difference is that you will set your content type to 'text/xml' instead of 'text/namevalue'. Here is a simplified example I used for testing with Paypal's reporting engine:


* Create HTTP client object
  CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_DESTINATION
    EXPORTING
      DESTINATION           = 'PAYPAL_REPORTING'
    IMPORTING
      CLIENT                = GV_CLIENT
    EXCEPTIONS
      DESTINATION_NOT_FOUND = 1
      INTERNAL_ERROR        = 2.

  IF SY-SUBRC NE 0.
    MESSAGE E184 WITH SY-SUBRC.
  ENDIF.

* Build the request
* HEADER
  CALL METHOD GV_CLIENT->REQUEST->SET_METHOD
    EXPORTING
      METHOD = GV_CLIENT->REQUEST->CO_REQUEST_METHOD_POST.

  CALL METHOD GV_CLIENT->REQUEST->SET_CONTENT_TYPE
    EXPORTING
      CONTENT_TYPE = 'text/xml'.

  CALL METHOD GV_CLIENT->REQUEST->SET_HEADER_FIELD
    EXPORTING
      NAME  = 'Connect'
      VALUE = 'close'.

  CALL METHOD GV_CLIENT->REQUEST->SET_HEADER_FIELD
    EXPORTING
      NAME  = 'Host'
      VALUE = 'https://payments-reports.paypal.com'.

  CALL METHOD GV_CLIENT->REQUEST->SET_VERSION
    EXPORTING
      VERSION = GV_CLIENT->REQUEST->CO_PROTOCOL_VERSION_1_1.

* BODY
* GUI_UPLOAD called here to get XML file for testing ...
  SHIFT GV_XML_REQUEST LEFT DELETING LEADING SPACE.

  CALL METHOD GV_CLIENT->REQUEST->APPEND_CDATA2
    EXPORTING
      DATA = GV_XML_REQUEST.

* Get the length of the body
  CALL METHOD GV_CLIENT->REQUEST->IF_HTTP_ENTITY~GET_DATA_LENGTH
    IMPORTING
      DATA_LENGTH = GV_LEN.

* Set the length in the header
  GV_STRING = GV_LEN.

  CALL METHOD GV_CLIENT->REQUEST->SET_HEADER_FIELD
    EXPORTING
      NAME  = '~Content-Length'
      VALUE = GV_STRING.

* Now send the request
  CALL METHOD GV_CLIENT->SEND
    EXCEPTIONS
      HTTP_COMMUNICATION_FAILURE = 1
      HTTP_INVALID_STATE         = 2.

  IF SY-SUBRC NE 0.

    CALL METHOD GV_CLIENT->GET_LAST_ERROR
      IMPORTING
        CODE    = GV_SUBRC
        MESSAGE = GV_STRING.

    WRITE:/ 'Send Error:', GV_STRING.
    EXIT.

  ENDIF.

* Get the response from the ICM
* Receive code goes here...