cancel
Showing results for 
Search instead for 
Did you mean: 

How to consume a .NET webservice (API) from ABAP (without PI/XI)

manoj_goyal2
Participant
0 Kudos

Hi Guys,

Can somebody share an ABAP code to call .NET webservice directly from ABAP program?.   I am trying to pass the date from ABAP to .NET API.

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

former_member197445
Contributor
0 Kudos

Here is the main part of how you accomplish this. 

DATA: client_init TYPE REF TO if_http_client

cl_http_client=>create_by_url(

    EXPORTING url = 'http://server.your-website.com/api/contract'

    IMPORTING client = client_init

    ).

client_init->send( ).

client_init->receive( ).

json = client_init->response->get_cdata( ).

client_init->close( ).

WRITE:/ json.

HERE IS MY FULL WORKING EXAMPLE REPORT PROGRAM.  It's just a small prototype that consumes a web API service and writes JSON to the screen.

There are also many different JSON parsers for ABAP.  One of them is used in the ABAP example posted to the code sharing site.

See Also:

Answers (0)