SAP CPI using Inbound HTTP
We offer in CPI the possibility to use WebService via HTTP Adapter. I usually use this feature to quickly test an Integration Flow. Especially if I don’t have an SOAP Interface
- SFTP
- Timer Event
- …
Of course you could add a Content Modifier and set the payload hardcoded, but I preferred to have more flexibility and testing different use cases without redeploying the IFlow. The first time I used the http Adapter I couldn’t find the Endpoint or any documentation how to find this (documentation is now far better but still the endpoint is not shown as you have it on SOAP Interfaces.
IFLow with HTTP Endpoint:
IFlow with SOAP Endpoint:
Where to find the HTTP Endpoint?
In the past I couldn’t find this information in the documentation, but when I looked around in the Cloud Cockpit
I could find the following information
I knew that cxf is used for the SOAP Endpoints so I tried if http is working for the HTTP Endpoints.
So I jused used the HTTP URL and added my values from the channel configuration.
To test the IFlow I used Postman
In the use case above I had to implement a quick access to the ARIBA Catalog. The customer already implemented the On-Premise coding to directly access ARIBA via REST Call. Afterwards they had to follow architecture guidelines to use CPI as middleware between. Therefore I created an HTTP Inbound Interface on CPI.
Update: As of the hint of Eng Swee Yeoh and Maximiliano
We can use dynamic endpoints by adding wildmask to it e.g.
<BASE_PATH>/http/AribaCatalog/*
This allows to send requests like: <BASE_PATH>/http/AribaCatalog/catalogs?date=2014-01-01T00:00:00
The Camel server automatically extracts the query and the resource into following header fields:
CamelHttpQuery : date=2014-01-01T00:00:00
CamelHttpPath : catalogs
If you don’t remove those Header fields the get automatically added on the HTTP Outbound Adapter.
I hope this helps to quickly set up an HTTP IFlow.
Hi Richard
If you read up the online documentation for Sender HTTP adapter, you can find the details below without going through a guessing game:-
You can invoke the HTTP endpoints using the syntax <Base URI>/http/<Value of address field>. You can get Base URI value from Services tab in Properties view of a worker node
Also, not entirely sure what you mean by "this wasn’t enough since HTTP Adapter can’t handle real REST Calls" - what's your definition of real REST calls?
Regards
Eng Swee
Hello Eng Swee,
thanks for your response. The first time I used the HTTP Adapter there was not such a documentation regarding the endpoint, but took some time until I wrote the blog.
Why it isn't a real REST Adapter. Since the Endpoint is hardcoded and you can submit a REST Request
e.g. the HTTP Endpoint:
https://e2148-iflmap.hcisbt.eu1.hana.ondemand.com/http/eai/AR/v002/AribaCatalog
you now can't call something like
https://e2148-iflmap.hcisbt.eu1.hana.ondemand.com/http/eai/AR/v002/AribaCatalog/catalogs/1
https://e2148-iflmap.hcisbt.eu1.hana.ondemand.com/http/eai/AR/v002/AribaCatalog/catalogs?date=2014-01-01T00:00:00&supplierdomain=buyersystemid
since this endpoint is not available.
For that purpose I added the the resource as an additional HTTP Header and could afterwards generate an ARIBA Catalog Rest Call
https://eu.openapi.ariba.com/api/catalogcontent/v1/prod/catalogs?date=2014-01-01T00:00:00&supplierdomain=buyersystemid
Kind Regards
Although the endpoint is hardcoded (i.e.https://e2148-iflmap.hcisbt.eu1.hana.ondemand.com/http/eai/AR/v002/AribaCatalog), you can still call it with URL below:-
https://e2148-iflmap.hcisbt.eu1.hana.ondemand.com/http/eai/AR/v002/AribaCatalog/catalogs/1
It will still reach the same endpoint, and you can extract the path details which is stored in Camel Header CamelServletContextPath. You can then add further logic as necessary.
Hello Eng Swee,
seems my CPI tenant is working different then yours 🙂
When i call something like:
https://e2148-iflmap.hcisbt.eu1.hana.ondemand.com/http/eai/AR/v002/AribaCatalog/catalogs?date=2014-01-01T00:00:00&supplierdomain=buyersystemid
I get the following response from CPI
<html>
<head>
<title>Error report</title>
</head>
<body>
<h1>HTTP Status 404 - Not Found</h1>
</body>
</html>
Means service not found. Maybe you can enlight me how did you set this up?
Kind Regards
Hi,
You need to check the documentation :
So, if you put "/myhttptest/*" as address in sender http cc you can call to CPI with url "<BASE_PATH>/http/myhttptest/<anything>"( I tested it and works 😉 ).
kind Regards.
Max.
Hi Richard
Have a look at Max's response above.
Additionally, there is a mistake in my earlier response. The HTTP call details are in Camel headers CamelHttpUrl & CamelHttpQuery (refer documentation for more details). Below is an example of a call to an endpoint that is configured with /dyn/*
Regards
Eng Swee
Thank you both for the response. I'll have to update the blog in that case.
Kind Regards
Hello Richard,
Could you please share the IFLOW details where Ariba API call was made using HTTPS call.
Thanks,
Rahul
Hello All,
How to display/see the incoming and outgoing data of CPI?
I have added customer fields using extensibility and mapped with CPI structure.
But, I am able to update the standard field records, not the custom/extensibility field.
I would like to know, what is my incoming and outgoing data of CPI. also I need to debug and test my mapping logic.
could you please help me.
Regards,
Akshath L.T