cancel
Showing results for 
Search instead for 
Did you mean: 

SAP - > PI < - > REST Webservice

Former Member
0 Kudos

Hi Experts,

The above scenario is hat I have to realise.. From what I have read on scn.. I conclude th use of Advantco REST adapter..

But the client has just oen interface and I could not justify the need for the investment on the REST adapter..

How else can this be realised??

The data is sent from SAP to PI goes to the rest webservice provider and send the response back to Pi and then to SAP.

I have done it using SOAP adapter.. but runnign out of ideas with REST..

Have never worked with HTTP adapter.. so it makes things worse for me...

Need ur help

Regards,

Teja

Accepted Solutions (1)

Accepted Solutions (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Ravi,

              When you start development with REST web services

You need API guide from REST web server.

Its always advisable to use REST adapter:- Because in future similar need might arise then you can use the same adapter. In my view in future most of the web services will switch to REST because of the ease of using it.

Not sure if you have gone through the nice blog by Former Member on synchronous REST web services

http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/08/11/calling-synchronous-restful-web-s...

Please kindly, if possible, rate this blog if you find it useful.

If you do not want to use any adapter the development becomes quite complex but achievable.

Here is how you should proceed

SAP<----->IDOC/RFC<----->SAP-PI<----->java mapping<------>REST web service

Rest web service follows client server architecture. Thus you can replace the code behind the adapter with java socket programming. This code completely replaces need of any channel. As I have stated earlier maintenance of such interface requires good knowledge in java and has to be very carefully made to avoid all hard coding of server details.  

Regards

Anupam

sufw
Active Participant
0 Kudos

Hi Anupam,

I would have to disagree quite strongly with your recommendation of the following approach:

SAP<----->IDOC/RFC<----->SAP-PI<----->java mapping<------>REST web service

I don't think I could think of a way of implementing this which has more overhead! Custom IDoc development is not something I would embark on in late 2012...

To the Original Poster, A RESTful API is just HTTP. It is synchronous by design. PI will add zero value here in this scenario, so I would pursue an approach which makes the HTTP calls directly from your ABAP system.

Regards,

Sascha

anupam_ghosh2
Active Contributor
0 Kudos

Hi Sascha,

                   I completely agree with your view. Its possible to access REST webservices directly from SAP system using ABAP code. There are a number of blogs on it  as shown below

http://wiki.sdn.sap.com/wiki/display/Snippets/RESTful+ABAP+controller

Here the question was posted in PI forum so I assumed that Ravi is trying to integrate SAP with REST using SAP-PI thus I suggested the possible way to integrate. I have also strongly suggested use of adapter for doing the integration with REST.  

  Finally if you are trying to build  this scenario

SAP --------SAP-PI-------REST

what should be the mode of communication between SAP and SAP-PI ?

REST web service cannot trigger a scenario in middle-ware (SAP-PI), then triggering event has to be from SAP side. Looking forward to your able guidance in this regard.

  Regards

  Anupam

sufw
Active Participant
0 Kudos

Hi Anupam,

I agree that this integration would have to be triggered by the ABAP server. I would use an ABAP proxy to trigger this - to me this is the simplest approach. If the REST API is based on XML payloads, then the proxy could mirror the payload format.

Regards,

Sascha

anupam_ghosh2
Active Contributor
0 Kudos

Hi Sascha,

                  when you say that ABAP proxy will be a simpler approach then do you include SAP PI in the scenario or not? Secondly if you include PI in the scenario could you please explain why you think ABAP proxy scores over an idoc/RFC ? I mean even in 2012 I can see projects being developed where batch jobs in SAP are triggering idocs and sending to SAP-PI. I am not a ABAP developer  thus I have limited knowledge in this regard. Generally in projects (one I worked with SAP-ISU) SAP is kept only for business logic , where as all communication to external third party is taken care by SAP-PI. This is to reduce burden on SAP server. I think this is the reason Ravi has posted the question in PI forum.

Thank you for you kind response to this thread.

Regards

Anupam 

Former Member
0 Kudos

Hi Ravi,

You can go with two approach, AXIS adapter and JAVA Proxy approach. I did using AXIS and also Java Proxy and it is working fine without any issues.

I would say the Java Proxy approach is better as you can support all HTTP methods of PUT, POST, DELETE, TRACE, PATCH etc

You can create your Java proxy in NWDS and expose it as a web service and call it using a receiver SOAP adapter.

Adios

Ravijeet

Former Member
0 Kudos

Hi Ravijeet,

When you used AXIS adapter, is it dynamic URL configuration as per the blog http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/08/11/calling-synchronous-restful-web-s...

or, is it other way? In case if it is dynamic URL way then how did you overcome the 200 char length limitation?

Thanks,

Yaseen M

sufw
Active Participant
0 Kudos

Hi Anupam,

I usually prefer ABAP Proxies over RFCs for a number of reasons: I find them much easier to set up, with less need for (for me) mysterious Gateway setup, et. They are less proprietary as they are essentially SOAP with some added bits, which means they are easy to test using external, industry-standard tools like soapUI, which is a big bonus for me. Plus I find them to be a little bit easier to monitor. Finally, SAP themselves discourages the use of anything other than ABAP Proxies for system integration in the Best Built Apps guidelines.

I'm very much against architectures which prescribe product X to be the only solution for a fairly broad spectrum of problems, such as mandating the use of PI for all inbound and outbound communications with a suite of SAP systems. Usually, this results in extra overhead for little or no gain, e.g. by forcing all synchronous communication through PI where you can't monitor it anyways (not without making performance sacrifices in PI), and bypasses a lot of good functionality which SAP has developed and the customer has paid for (e.g. the integration capabilities in NetWeaver). I think with an evolving landscape and the introduction of more integration approaches (think NW Gateway, REST APIs, ETL, etc.) such a simplistic position becomes less and less beneficial.

I'm a big fan of choosing the right tool for the job - even if this means having more than 1 tool do "integration". In the case of the original question, I think PI is not required, and if it has to be used, then I would stay away from proprietary stuff like RFCs for system to system integration.

</rant>

Sascha

anupam_ghosh2
Active Contributor
0 Kudos

Hi Ravijeet,

             I achieved the same using java mapping. It would be of great help if you could suggest a blog or article on java proxy which will be similar to the current requirement and shows clearly step by step process. I am looking out for java proxy alternative of the same. Searching in SCN gives a lot of articles but I am unable to get the one required for this kind of scenario. Thank you so much for your kind response to this thread.

Regards

Anupam

anupam_ghosh2
Active Contributor
0 Kudos

Hi Sascha,

                   Thank you for your kind response and wonderful explanation.

Regards

Anupam

Former Member
0 Kudos

Hi Anupam,

Yes need to put the blog on SAP PI - REST architecture using Java Proxy.

Had been busy lately with lot of SAP - Salesforce integrations so will come with the blogs shortly. Also had to write the blog on SAP PI - Fedex integration.

Regards

Ravijeet

Former Member
0 Kudos

Thanks a lot guys.. has been a very informative discussion...

Can you please give me a mock code on how this is handled in Java mapping?

AXIS adapter??.. does come default with the standard adapters in the configuration?

anupam_ghosh2
Active Contributor
0 Kudos

Hi Ravi,

              As posted by Sascha Wenninger   you should try communicating with REST web server from SAP itself without involving SAP-PI. This should be taken care by ABAP team personnel (in case you do not belong to the ABAP team). Secondly try using advantco's REST adapter to do the integration. Thirdly have a  look into this wonderful  blog by Saravana Kumar Kuppusamy where he has shown  communication to a third party server using java socket. REST web service follows client-server model hence using java sockets you can read from and write to server. Thirdly you can try out java proxy method as explained by RAVIJEET DAS .  Each REST web service comes  with different method of authentication,request-response format thus you need to consult your own API guide to write the code. Finally one small request, in case you find the blogs mentioned in this thread useful, please kindly , if possible, rate the blogs.

Regards

Anupam

Former Member
0 Kudos

Hi Sacha,

I wanted to know how can calling REST api be handled in ABAP proxy.

The get method can be implemented in calling the Rest webservice directly.

Thanks

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ravi,

How have you finally implemented this REST API integration with SAP PI.

I also need to handle it in Java mapping I guess as other options are not feasible.

Thanks

anupam_ghosh2
Active Contributor
0 Kudos

Hi Radhikachetana P,

                                          Please can you open a new discussion . You might not get responses on a closed thread.


Regards

Anupam

rajasekhar_reddy14
Active Contributor
0 Kudos

Read below doc and explore more in SCN may be you will find someway to integrate Rest web services.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/03/21/rest-services-with-gateway-and-pi...