Skip to Content

Calling an HTTPS Webservice from ABAP

Hi guys.

Im trying to get some information from an External Webservice. I checked the WSDL using SoapUI and it worked good. Now, im passing the same info in ABAP, but i dont get any result. Is it possible to call an HTTPS Webservice from ABAP? or do I need to do something else? This is my code:

TYPES: BEGIN OF datos_servicio_web,<br>  http_url  TYPE string,<br>  proxy_host  TYPE string,<br>  proxy_service  TYPE string,<br>  http_data  TYPE string,<br>  http_result  TYPE string,<br>END OF datos_servicio_web.
DATA: tweb TYPE datos_servicio_web.
DATA:  http_client  TYPE REF TO if_http_client,<br>  http_rlength TYPE i.
<br>CONCATENATE<br>'<soap:Envelope xmlns:soap="<a href="http://www.w3.org/2003/05/soap-envelope">http://www.w3.org/2003/05/soap-envelope</a>" xmlns:ban="<a href="http://bancocentral.org/">'">http://bancocentral.org/">'</a><br>  '<soap:Header/>'<br>  '<soap:Body>'<br>  '<ban:GetSeries>'<br>  '<ban:user>XXXX</ban:user>'<br>  '<ban:password>XXX</ban:password>'<br>  '<ban:firstDate>2016-10-12</ban:firstDate>'<br>  '<ban:lastDate>2016-10-12</ban:lastDate><ban:seriesIds>'<br>  '<ban:string>F073.UFF.PRE.Z.D</ban:string>'<br>  '</ban:seriesIds>'<br>  '</ban:GetSeries>'<br>  '</soap:Body>'<br>'</soap:Envelope>'<br>INTO tweb-http_data.
tweb-http_url = 'https://si3.bcentral.cl/SieteWS/SieteWS.asmx?wsdl'.<br>http_rlength = strlen( tweb-http_data ) .
CALL METHOD cl_http_client=>create_by_url<br>  EXPORTING<br>  url  = tweb-http_url<br>  proxy_host  = tweb-proxy_host<br>  proxy_service  = tweb-proxy_service<br>  IMPORTING<br>  client  = http_client<br>  EXCEPTIONS<br>  argument_not_found = 1<br>  plugin_not_active  = 2<br>  internal_error  = 3<br>  OTHERS  = 4.
CALL METHOD http_client->request->set_cdata<br>  EXPORTING<br>  data  = tweb-http_data<br>  offset = 0<br>  length = http_rlength.
<br>CALL METHOD http_client->send<br>  EXCEPTIONS<br>  http_communication_failure = 1<br>  http_invalid_state  = 2.
CALL METHOD http_client->receive<br>  EXCEPTIONS<br>  http_communication_failure = 1<br>  http_invalid_state  = 2<br>  http_processing_failed  = 3.
<br>CLEAR tweb-http_result.<br>tweb-http_result = http_client->response->get_cdata( ).
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Oct 14, 2016 at 08:23 AM

    Hi, there are a lot of old question and a nice guide from Thomas Jung.

    Initial questions: did you try to debug? If yes, which result you have?

    Second one: did you setup the SSL certificate?

    With SSL, trying to invoking a service, I found more easy to manage to create an HTTP connection with its own SSL certificate to avoid security issues.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 01, 2016 at 08:13 PM

    Hi, i searched a lot, but nothing is working, i debugged and result at the

    CALLMETHOD http_client->receive is http_communication_failure.

    I havent setup the SLL certificate...no idea what I need to do or if BASIS need to install sth in the server.

    I checked the WSDL using SoapUI without installing any cetificated and worked good, why should I have to install it...and where?

    The webservice is giving by a bank company, so companies can use it to get the currency information among other things

    Regards

    Miguel

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 17, 2016 at 01:25 PM

    Hi,

    i answered you 3 days ago...and this new SDN...no comments.

    well, the result that i get is "CALLMETHOD http_client->receive<br>EXCEPTIONS<br> http_communication_failure =1"

    I installed the certicated in DEV system using STRUST tcode.

    any ideas?? do I have to change my code? where...

    Regards

    Miguel

    Add comment
    10|10000 characters needed characters exceeded

    • Sorry, i did not saw your answer since in the new community you get notification only if someone comment your own answer(......).

      STRUST is not enough :)

      As I wrote, check Thomas Jung's blog

      You are missing a step

      Bear in mind that the changes made in the trust manager will only take effect after you restart the application server or at least the ICM (transaction SMICM, Administration -> ICMAN -> Exit Soft).