SMP 3.0 : Accessing more than one OData services in one application
We have been knowing that SMP 3.0 is based on OData. To access any SAP & NON-SAP Backend (SOAP WS, Database,JPA & REST service) data services in SMP for developing any hybrid/native application there is a provision in SMP to convert those services into OData services with the help of SAP Mobile Platform Tools in Eclipse Kepler. For example, I have created 4 different OData services with the help of below details:
|SAP System (ODC)||https://jk:8083/gateway/odata/SAP/SAMPLEFLIGHT;v=1||Guide|
Now i want to incorporate all above mentioned OData services in a single application id. How to do this? How to access information from all services? Here you go.
- Login to “Admin cockpit” https://jk:8083/Admin/
- Create a new application id: New>
3. Under BACKEND tab, copy of the mentioned above URL. This URL would act as a PRIMARY Back-end Connections URL
Note: From SP04 PL01 onward, all Integration gateway (IGW) URLs are HTTPS based and listen on https admin port 8083/8084.
While whitelisting IGW URLs provide SMP server host name not localhost or ip address.
4. To add another two URLs, Click on NEW button under Back-end Connections and provide connection name and respective URLs for both.
Note: If you are accessing any external resources through a proxy network, make sure to configure proxy settings in SMP server and select “Use System Proxy” option. Check this.
5. Under AUTHENTICATION tab, provide a security profile as per your wish. I have selected admin under EXISTING PROFILE
6. Once done, make sure connection to these services are successful from SMP server.
7. Open a REST Client. Next task is to register the application id. How to do that? You must get a “201 status code” on success.
8. Lets take some example for accessing data from different URLs.
8.1 From JDBC:DEPTHSQLDB
8.2 To access SOAP WS information
- Replace com.test.demo by com.test.article
- Here “ArticleSet” is the entityset.
- At right hand side, ARTICLE is the only ENTITY SET for given URL. To access its information add this at the end of backend URL.
Note: Payload for POST request can be found at this guide.
8.3 To access SAP netweaver gateway information
- Replace URL by https://jk:8081/com.test.odcflight
- To access it’s entity information add entityset name at the end of URL.http://jk:8080/com.test.odcflight/BookingCollection
8.4 To access REST Service information
- Replace URL by https://jk:8081/com.test.ThomasREST
For POST, PUT, DELETE: Make sure you get a X-CSRF-TOKEN value in GET request and pass this value in header section along with other header sets. For more info check : SMP 3.0 : REST API Application Development
NOTE: X-CSRF-TOKEN value is needed for the Odata services (have been converted using Integration Gateway) for doing any transactions.
I hope this blog will help you.Your comments and suggestions are most welcome.