cancel
Showing results for 
Search instead for 
Did you mean: 

Webhooks & SAP Cloud application studio

solene_roques
Participant
0 Kudos

Hello all,

I would like to integrate webhooks generated by an external application into ByDesign through SAP Cloud Application Studio (ByDesign or C4C). If anyone has already made it, could you give me an overview of what elements are needed please ?

My external application can generate html POST webhooks or SOAP webhooks. As far as I know, like the x-csrf-token is needed for POST OData action, my only option is to integrate SOAP webhooks.

Thanks for your help,

Best regards

thiago
Product and Topic Expert
Product and Topic Expert

Hello Sonène,

We are going to release blog posts related to event-driven architecture in a weekly basis, discussing concepts, delivering tutorial videos, sharing code and more.

This is the first of the series: https://blogs.sap.com/2020/10/09/how-to-get-sap-business-bydesign-events-in-a-loosely-coupled-soluti...

Best,
Thiago.

Accepted Solutions (0)

Answers (3)

Answers (3)

jravnik
Participant

Dear Solène,

the two possibilities to make a custom inbound interface are OData or SOAP.

For OData you will need to create a Custom Business Objekt in SDK and create an OData service in the admin work center within ByD. For the POST request you will need to use the x-csrf-token header, it will not work without. Also the JSON/XML you are receiving needs to have the compatible format (standard OData).

For SOAP you will also need to create a Custom Business Object in SDK and create a inbound service in SDK too. With that and the corresponding communication agreement you can create the necessary request from the WSDL. This also implies that the 3rd party can send a valid SOAP request which fits the schema of the WSDL.

Unfortunately there is no way to define some kind of "freestyle" endpoint which can receive and work with any kind of data structure.

Best regards
Jürgen

solene_roques
Participant
0 Kudos

Dear Jürgen,

Thanks for this summary.

In my case, the 3rd party can not manage x-crsf token, so OData is excluded.

In the SOAP scenario, the service is already created by the 3rd party (standard on their side). I created an External webservice integration based on the wsdl provided by the 3rd party (and the communication agreement). But what should be done regarding the custom BO ? How can I create a BO that will perfectly fit the data given by the message ?

Thanks, best regards

jravnik
Participant

Dear Solène,

for the inbound communication via SOAP you have to create a Custom BO in the SDK. For that BO you will define a Web Service: https://help.sap.com/viewer/cbcebe3cfb1647a8b0322c18dbb0b481/2020.08/en-US/74f86f6073e210149e3fd0678...

That means that the WSDL will be generated by the SDK, which you cannot manipulate in any way.

So your 3rd Party must work with the WSDL generated by the SDK. You cannot use their WSDL as an inbound service definition.

Best regards
Jürgen

solene_roques
Participant
0 Kudos

Dear Jürgen,

Thanks for this answer. Thus, in a situation like mine where : the 3rd party has deployed two web-hooks methods : POST and SOAP standards on their side and non-customizable, we are not able to integrate webhooks into ByD.

Sad situation because webhooks are quite useful.

Thanks,

Best regards,

VishnAndr
Active Contributor

Hi Solene,

What Jürgen and Saurabh suggested would work.

However, in C4C (unfortunately, I don't have access to ByDesign to confirm), there are ways you can go with OData without CSRF token.

Please check C4C OData documentation here:

https://github.com/SAP/C4CODATAAPIDEVGUIDE#csrf-token

And this blog post:

No need for CSRF token when calling C4C OData

Hope this helps.

former_member226
Employee
Employee
0 Kudos

Hi,

You can integrate webhooks into SAP C4C using SAP Cloud application studio. In order to do so you would need to:

1. Create an external web service interaction using the webhook URL.

2. Configure the generate communication arrangement for web service integration created in last step.

3. Now call the web service webhook via ABSL code based on your business need using reuse library WebServiceUtilities.ExecuteRESTService.

For more details please refer: https://blogs.sap.com/2018/12/06/use-restful-service-to-consume-s4-functionality-in-sap-cloud-for-cu...

solene_roques
Participant
0 Kudos

Dear Saurabh,

Thanks for your answer.

However, I am not sure that my case is similar to the case in the blog post. I need my ByD to be able to receive passivly data from a third party. There is no trigger on ByD (different from the C4C button in the blog post). The external system sends webhooks depending some events on their side and ByD needs to able to receive them.

Indeed, I assume it requires a external webservice integration. The third party external system requires an URL where to send the data, what would it be please ?

Thanks

former_member226
Employee
Employee
0 Kudos

Hello,

I am not a ByD expert but I believe there must be ByD Public OData APIs that can receive this data but I think someone from ByD background can confirm this.

Sorry!

solene_roques
Participant
0 Kudos

Hello,

It will be perfect to use OData but I faced the CSRF token issue. My external system is not able to launch a GET request first to obtain the csrf token and then set it into the POST request

Thanks

former_member226
Employee
Employee

Fetching a CSRF token is fairly simple as it is quite a standard procedure in all of the SAP API communications and there are a lot of blogs and discussion post available on SCN that talks about how to deal with it.

In case your system is unable to make a GET call to fetch CSRF token then as a workaround you can build a simple wrapper API, maybe using CPI iflow or SCP API Management. This sample API end point will be triggered by your external system as a POST call but within this API you can make GET call to fetch the CSRF and then handle POST to do the data operation.

solene_roques
Participant

Using a between API to manage csrf token is a good idea. I will think about it but I do not think I will manage to do it because this development is running without any middelware (SCPi or other), it is only third-party system (that only launch POST request and I can not modify anything on it) , SAP Cloud App Studio and ByD.

Thanks