cancel
Showing results for 
Search instead for 
Did you mean: 

Calling RESTful webservice in SAP PI

Former Member
0 Kudos

Hello All,

Please drive me for calling RESTful webservice in SAP PI 7.30.

We do not have any REST adapter to call this webservice, I guess SOAP adapter not works. So how we going to achieve this step in PI?

Please share your experience and knowledge on this topic, it was very helpful at this time.

Thank you very much for reading this thread.

Gayatri.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thanks for your valuable advises.

Following one is design we concerned at this point for development, may be source may change later time.

for Initial/delta loads, this is one or 2 times.

File(CSV) --->PI---->Java mapping ---->request---->REST webservice ----->response-->same java mapping ---> PI/JDBC--->DB.

for recurring loads(live) : source is not decided, based on delta loads then design will change:

Webpage/webservice(soap)/file--->PI-->java mapping -->request-->REST webservice  --> response--> same java mapping--->PI/JDBC-->fDB.

Other design concern was, when we get any error while response throw, then we need to catch that error and send a email to users.

So please tell me , how do I include this step in my design, I think i have to use BPM ? with mail adapter should send this errors.

If you have chance , pls. explain me BPM flow, if at all.

May be we may not get firewall issue , because these all applications reside in with in intranet , if at all required I'll contact to Network team.

Thanks,

Gayatri.

former_member184720
Active Contributor
0 Kudos

Hi Gayatri - i don't find any issues with your design.

Reg: your email alert - If you setup the interface alerts you'll get the error message and alert notification right? is'nt enough?

do you want to send any specifc email from the mapping? If so please check the below wiki to know how to send an email from a UDF..

Capture the responce/error/info and send the email..

http://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=90570965

Former Member
0 Kudos

Thanks Hareesh!

Based on input request the REST webservice sends the response, if that request not have valid parameters then Webservice throw the message, which we need to catch and send it to users thru email.

Alerts also we considering for application, system and mapping errors purpose.

But mail adapter main purpose was catch the error message from webservice response payload  and send it to users.

I am thinking for BPM is required ? is it correct? without BPM shell we handle?

Thanks,

Gayatri

former_member184720
Active Contributor
0 Kudos

Hi Gayatri - You don't need a BPM to send an email.

From you java mapping you are making a call to webservice.

Based on the responce ->you can send an email message from the same java mapping.

Did you check the above link? just simply write the code to send an email from java mapping based on the responce.

Import the provided java classes and simply add the below code in your java mapping to trigger the email.

email mail = new email();

mail.send("<mailhost>", "<to emailid>", "<subject>", "<content>", "<from emailid>");

Regards,

Hareesh

Former Member
0 Kudos

Thanks , Will do !

Former Member
0 Kudos

Hi Gayatri,

We have SAP PI 7.3 as well, and we are facing probably exact the same situation, so your solution could work for us. I am just wondering did the solution below, just pure java mapping, without using Soap Axis, work for you in your SAP PI 7.30 landscape?

 

ECC--->proxy--->PI--->java

or ABAP mapping---->request--->REST webservice--->response---->same java or ABAP

mapping---->proxy---->ECC.

It would be very helpful to hear your feedback.

Blue

Former Member
0 Kudos

Yes..it was complete java mapping used for calling RESTFul webservie.

SOAP Axis not worked in my case.

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks for your ideas on this question.

We got our Java code to call that RESTwebservice, in java code we are passing parameters to call the methods in RESTwebservice and getting the response back.

Now please tell me, how do I call this java code in PI?

Is it Java mapping and along with SOAP/Axis Adapter for invoke that webservice?

bit confusion here..

Thanks,

Gayatri

former_member184720
Active Contributor
0 Kudos

Hi Gayatri - call the web service from your java mapping and pass the response back to sender application.

Have a look at the below blog for reference.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Gayatri,

                     You need a triggering event from ECC.

1. "Now please tell me, how do I call this java code in PI?"

ans)

Thus scenario can be like this

ECC--->proxy--->PI--->java mapping---->request--->REST webservice--->response---->same java mapping---->proxy---->ECC.

2. Is it Java mapping and along with SOAP/Axis Adapter for invoke that webservice?

ans) only  java mapping is sufficient.

Challenges

1. when you send the request to REST webservice from PI server , the firewall may stop our request and you will get an exception

solution: Network team consultation is necessary in this regard

else all is well.

Regards

Anupam

anupam_ghosh2
Active Contributor
0 Kudos

Hi Gayatri,

                    I am not sure if SOAP adapter will be able to work if resultant payload becomes more in size. REST web service follows client server architecture. Thus you can send a request via socket and receive a response. The entire code can be represented using java mapping. Alternatively you can also send a http request in mapping instead of Java Socket programming.

Regards

Anupam

gagandeep_batra
Active Contributor
0 Kudos

Hi Gayatri

I think soap with Axis will work for you:

you can also check the below blog that may help:

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

Regards

Gagan