Skip to Content

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:

 

 

Connection Details URL Reference
JDBC (HSQLDB) https://jk:8083/gateway/odata/SAP/DEPTHSQLDB;v=1 Guide
SOAP WS https://jk:8083/gateway/odata/SAP/ARTICLE;v=1 Guide
SAP System (ODC) https://jk:8083/gateway/odata/SAP/SAMPLEFLIGHT;v=1 Guide
REST Service https://jk:8083/gateway/odata/SAP/THOMASRESTIGW;v=4 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.

 

  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)

To report this post you need to login first.

17 Comments

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

  1. Hemendra Sabharwal

    Hi Jitendra,

    As usual, awesome blog from you, Thank you so much. I have little concern, I am developing Native Android App, I am getting the problem in consuming multiple OData services on Android Studio, however it is accessing the “Primary URL”, but it would be good if you suggest how to consume “Secondary Services”.

    Is there any other way? However I am trying to access it using “Entity Sets” exposed by various other URLs from different DBs which is defined as connections to “Primary End Point URL”, but leading to nowhere.

    However I am also exploring “Service Mashup in IG” (Service Mash-up in Integration Gateway – It’s Simpler Than You Think) suggested by Midhun, my another favorite like you.

    And another option of having “Relative URL” in SMP, is also beyond my understanding now. I am not clear on the role of having “Relative URL” option in SMP, Is this the way to go further? Please advice.

    Thanks,

    Warm Regards

    Hemendra

    (0) 
    1. Jitendra Kansal Post author

      Hemendra Sabharwal

      It is always advisable to have one OData endpoint for one mobile app.If you want to retrieve info from more than one data sources (looks like your case), you can create multiple entitysets connecting to respective data-sources using IGW.  At the end, you will have one service document having all entity sets. You can mash-up among all.


      If you have any other issues, I would request you to raise a new thread, you may give reference of blogs/docs you are referring to, plus share steps you have followed along with screenshots.

      Hope this helps.

      Regards,

      JK


      (0) 
      1. choong chan hol

        Hi JK,

        Actually CauseCodeCollection and CauseGroupCollection is come from a single RFC FM.

        Means that my FM zgetlist return multiple table such as CauaseCode and CauseGroup.

        May I know what is the best approach which able to avoid call multiple request?

        Regards

        Choong

        (0) 
  2. Kael Xin

    Hi JK,

    I have two questions,

    1.I have registered an application ,but I’ve also registered many

    Back-end Connections in this application.

    how can I access these connections with smp3 native sdk?

    2.Must I create all the entities in the same project with the TCODE “SEGW”.

    Best Regards,

    Kael

    (0) 
    1. Jitendra Kansal Post author

      Kael Xin

      You can go either way

      1. you have to call each service by their connection name, e,g. com.test.northwind

      OR

      2. You can create all entities in same project, so at the end , you will have a single OData URL having all entities.

      If you have any further questions, feel free to post at SMP Developer Center

      Regards,

      JK

      (0) 
      1. Kael Xin

        Dear Jitendra

             I try to create two backend connection in one application(the backend url is same),

             But I got the error code’403′ with the Advanced rest client.

             the backend connection works fine in application with single backend connection.

             The SMP Server version is SMP3.0 sp08,

             Can you help me?

             

        Best Regards,

        Kael

        (0) 
        1. Jitendra Kansal Post author

          Kael Xin

          I request you again to post your query at below forum by clicking on ‘Start a discussion’ ,

          SMP Developer Center

          You can provide relevant screenshots with steps you have followed. You may also give references of docs/blogs you have been following for your approach. Make sense?

          Regards,

          JK (Moderator)

          (0) 

Leave a Reply