Skip to Content
Author's profile photo Former Member

Integrating REST Services on PI

Since last year’s TechEd, I have been getting a lot of question regarding whether SAP will provide a REST adapter for PI. Obviously, my follow-up question is “what will you do with a REST adapter?” I received the following responses:

  • We want to integrate with cloud applications, and other web-based applications using REST.
  • We have existing web services based on SOAP, and we would like to expose these services as REST for more efficient consumption by mobile devices. If there is a REST adapter, then we can re-use all the existing interfaces and mappings without any re-write.
  • We already have PI and now we want to use a REST adapter to develop new mobile-based applications to access our SAP and non-SAP systems and applications.

You can find more information on REST at Wikipedia :
Wikipedia http://en.wikipedia.org/wiki/Representational_state_transfer

Although SAP does not provide a REST adapter, one of our business partners, Advantco, does. Please see their blog on SDN:
REST adapter for Netweaver SAP PI

I had the opportunity to review and test Advantco’s REST adapter and have the following findings:

  • CRUD support:
    Since the REST framework is based on HTTP protocol, the operations are based on HTTP methods (GET, PUT, POST and DELETE). We can obtain these HTTP methods in rules for Receiver Determination and also in mapping programs, even though they will not be in the payload. I was able to create a single service, with the 4 operations, to select/insert/update/delete entries in a database table.

HTTP GET:  select/query

HTTP POST:  create/insert

HTTP PUT:  update/change

HTTP DELETE:  delete

  • Provisioning of REST service:
    After configuration, an HTTP URL based on the system and communication channel can be used by consuming applications to send a request to the adapter on PI. I used soapUI as the client program to test the REST services on PI.
  • Consumption of REST service:
    From PI, I was able to consume a REST service on an external system without any problem testing all operations of CRUD.  The receiver REST service is based on OData, which is XML-based.  So, I just mapped the message to the XSD of the REST service and sent to the receiver, along with the HTTP method.
  • Asynchronous interfaces:
    In most situations REST is used in synchronous interfaces, applications can also be asynchronous, as in case of sending an IDoc to an SAP system. The REST adapter can be synchronous and asynchronous.
  • Monitoring:
    Because the REST adapter is based on the SAP AFW (adapter framework), all existing tools for channel and message monitoring, etc., are available.
  • Accesses to SAP backend applications:
    As an experienced PI developer, I found interacting with backend ERP systems to be quite easy using BAPI/RFCs, proxies and IDocs. The processes remain the same, and just use the existing receiver adapters, e.g. RFC, IDoc.
  • Missing OData support:
    The adapter only supports the provisioning of REST services based on XML and JSON. Per Advantco, provisioning of REST services based on OData will be added in the future.

Advantco’s REST adapter is NetWeaver certified. If you have any interest in this adapter, please contact Advantco per the blog above.

I am not endorsing or recommending this REST adapter. But, due to the absence of one from SAP, and if you have a need for one, this is an option to explore.

Assigned Tags

      9 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Michal Krawczyk
      Michal Krawczyk
      Hi,

      I'd also suggest looking at AXIS adapter for REST support - in some cases this may be enough

      Michal's PI tips: Exchange Rates from an XML file on a web page - REST, AXIS

      Regards,
      Michal Krawczyk

      Author's profile photo Former Member
      Former Member
      Blog Post Author
      Yes, HTTP adapter can also be used in certain cases.  But, I think the most important functionality of a REST adapter is to be able to support CRUD, and to be able to obtain and send the HTTP method.  HTTP adapter can support GET and POST, but not PUT and DELETE.  AXIS is probably similar, maybe just POST.

      Another capability for REST adapter is the ability to support JSON, which is not based on XML.  JSON is widely used by many REST services.  Yes, we can develop custom java mapping programs to decode/encode JSON, but it would be much easier for developers to just configure in the adapter.  OData is coming along, especially with Microsoft applications.

      Author's profile photo Former Member
      Former Member
      Hi,

      I am using an RFC to HTTP scenario, in which the target URL should be dynamic.So i tried with dynamic URL concept in HTTP. But it has the limiation of 200 characters.But my URL length will be around 485.

      The API in the target side is REST API. So will the REST adapter will support this or we can achive this through HTTP adapter.

      Author's profile photo Roger Allue
      Roger Allue

      Hi William,

      As usual, you've made a great job. Thanks for sharing!

      Regards!

      Author's profile photo NarayanaSwamy Mariyala
      NarayanaSwamy Mariyala

      Hi William,

      Nice Blog!

      Is it possible to fetch attachments using REST adapter?

      Author's profile photo Former Member
      Former Member

      Hi All,

      I am using the receiver adapter rest, operation get or post


      Anyone have any example of how to receive more than 10 variables?


      Thanks,

      Author's profile photo Former Member
      Former Member

      Thank you for this great article.

      I'm looking for an example of how to set up the RESTAdapter to expose a GET operation, may be you can help me some way.

      Thanks again.

      Author's profile photo Former Member
      Former Member

      Hi Manuel Ricardo,

      Have a look at this link :

      Consuming Your First Synchronous RESTful Servic... | SCN

      😎

      Author's profile photo Former Member
      Former Member

      Hey Alejandro, thanks a lot, very good blog.  It helped me (y)