an abap rest client

Upload: ganeshkumar-sanur-gopalakrishnan

Post on 15-Oct-2015

110 views

Category:

Documents


1 download

DESCRIPTION

abap rest

TRANSCRIPT

An Abap REST ClientRecently Im focused on learning about Restful Web Services.

I think REST is much more immediate, easy and light than SOAP (however REST vs SOAP isnt the focus of this blog).

I developed an ABAP application (ECC 6.0 NetWeaver 7.01) to call several REST services exposed by an External System.

Normally I use 2/3 great Firefox extensions to test and call REST resources in addition to Firebug.

RESTclient : https://addons.mozilla.org/it/firefox/addon/restclient/POSTER: https://addons.mozilla.org/it/firefox/addon/poster/FIDDLER: http://www.fiddlertool.com/ (also Windows Version)

These extensions are really helpfull, we can use them, for example, to send post request, set basic authentication, add header fields and so on but suppose that in our scenario we cant use this extensions due to network policies because our local IP cant reach Http service.

Suppose also that only SAP hosts is configured to reach the url via Http port 80.

I began to create a custom report client "zutil_http_client" as i can't use Fiddler/Poster but after several test code I found the standard program RSICFCLTST01.

RSICFCLTST01 is a great tool based on cl_http_client, a test framework similar to RESTclient/Fiddler .

After run, the program show the following screen. In tab Session, we create the destination (by Url or by Http Destination)

On tab Detail we can set request fields, method type or other characteristics using IF_HTTP_REQUEST methods.In subtabs Detail -> Request -> Methods Ive set the value Rome for parameter wheater

At any time we can see our request switching to tab Detail -> Request -> Text

After that we call method SEND and RECEIVE on tab Detail -> Request -> Methods and then view the response in the appropriate tab.

I think it would be useful in future to have a tab JSON, however on tab Detail -> Request we can call all IF_HTTP_RESPONSE methods.