Skip to Content

SMP 3.0 : Accessing more than one OData services in one application

Hi All,

 

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:

 

 

 

 

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.

 

  1. Login to “Admin cockpit” https://jk:8083/Admin/
  2. Create a new application id: New>

    

     appIDCreation.PNG    

3. Under BACKEND tab, copy of the mentioned above URL. This URL would act as a PRIMARY Back-end Connections URL

 

          hsqldbcon.PNG

       

 

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.

 

/wp-content/uploads/2014/08/backendconn_655527.png

 

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.

 

ping.PNG

 

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.

 

regis.PNG

 

8. Lets take some example for accessing data from different URLs.

 

8.1 From JDBC:DEPTHSQLDB

 

    • As I have set DEPTHSQLDB as primary URL so i can get it directly by calling a GET method as below.
    • For getting entity set “DEPARTMENT” details, replace URL with  https://jk:8081/com.test.demo/DEPARTMENT
    • For POST, PUT, DELETE refer this blog.

     /wp-content/uploads/2014/08/hsq_655534.png

    8.2 To access SOAP WS information

    • Replace com.test.demo by com.test.article
    • Here “ArticleSet” is the entityset.

 

 

/wp-content/uploads/2014/08/art_655535.png

 

    • 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.

 

/wp-content/uploads/2014/08/artset_655536.png

 

Note: Payload for POST request can be found at this guide.

 

8.3 To access SAP netweaver gateway information

 

/wp-content/uploads/2014/08/odcfl_655537.png

 

 

8.4 To access REST Service information

/wp-content/uploads/2014/08/thoms_655538.png

 

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.

 

Rgrds,

JK (@jkkansal1987)

17 Comments
You must be Logged on to comment or reply to a post.