Skip to Content

An Abap REST Client

Recently I’m focused on learning about Restful Web Services.  

I think REST is much more immediate, easy and light than SOAP (however REST vs SOAP isn’t 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 can’t use this extensions due to network policies because our local IP can’t reach Http service.

Suppose also that only SAP host’s 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)

image

 

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

image

 

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


image

 

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

 

image

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.

12 Comments
You must be Logged on to comment or reply to a post.
  • Hi,

    Great Blog.. 🙂 .. I worked with your document.. It was helpful. I tried executing webservice through the reports it works great.. I just have a doudt on how to post the value to webservice through this report ? If i have a xml data to be passed to webservice how its possible to send through this.. ?

    Regards,

    Sivaganesh

    • Thank you!

      this is my first blog in SCN..I’m glad that an old blog is still useful 🙂

      If you need to post data you have to change the HTTP Method (it’s “GET” by default”) going to Detail -> Request -> Methods -> SET_METHOD method

      setMethod.JPG

      then you can past your XML data calling the REQ_SET_CDATA method (but I didn’t tried)

  • Hi Alessandro,

    Thank you for sharing. I was trying to replicate what you did but I don’t see any results populated in the Response – HTML container. Can you please provide some guidance?

    After I Sent the request:

    HTTPClient1.png

    The results in Response – Text:

    HTTPClient2.png

    The results in Response – HTML:

    HTTPClient3.png

    • Hi Meichun,

      I suppose the google API weather is deprecated…you can try with another link/Rest service,

      I’ll try to update asap the blog with another example

  • Hi Alessandro!

    I have the same problem as Meichum, it shows me the message: “This page can’t be displayed”. Currently we have installed Netweaver 7.31, with component SAP_BASIS 731, which is the minimum component we should have in SAP?

    Atte.

    Aleck