Skip to Content
Author's profile photo Midhun VP

SMP 3 – Configuring Application in Management Cockpit

Odata SDK SMP Configuration Develop App and Test


This blog is outdated, please follow the how to guides here:Mobile Application Development Platform for Developers – Native Apps

Getting Started

Create a new application in Management cockpit and configure the application settings as given below:

ScreenHunter_161 Jun. 25 00.13.jpg

Define backend connection. I am using an existing Odata service from Gateway trial system: http://sapes1.sapdevcenter.com:8080/sap/opu/odata/iwbep/gwdemo/

ScreenHunter_162 Jun. 27 02.44.jpg

Under Authentication tab create a new security called “SAPSecurity” >Click on New and choose “HTTP/HTTPS Authentication”. Provide the Odata URL: http://sapes1.sapdevcenter.com:8080/sap/opu/odata/iwbep/gwdemo/ . Choose Control as “Required“.

The security profile defines server authentication during user on boarding.

ScreenHunter_162 Jun. 27 02.45.jpg

ScreenHunter_162 Jun. 27 02.48.jpg

Finally Save the application. Select the application created and click on “ping”, that should give a success message. The created application details are used during development of native app.

ScreenHunter_162 Jun. 25 00.22.jpg

Assigned Tags

      32 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Midhun,

      Thanks for the write-up! Question, in the Gateway Cockpit, when I try to test the URL for my Service Document, I always get prompted to enter a username/password. It's like basic auth is setup on the server somehow. Is this expected? I've tried entering my machine user/password as well as the smpAdmin user, but can't get passed it.

      I have a Windows 7 box and have SMP3 SP03 installed for test purposes.

      Thanks!

      DJ

      Author's profile photo Jitendra Kansal
      Jitendra Kansal

      Daniel,

      When you deployed odata model to smp server (right click on project>generate and deploy. ..), you must given one "namespace"(by default it is "sap").

      This "sap"is nothing but your sec profile in "admin cockpit". So have you not created any such sec profile? Plz check.

      If still you face issue further, request you to raise a new thread.

      Rgrds,

      JK

      Author's profile photo Former Member
      Former Member

      Thanks JK! That worked! Sorry for hijacking the thread, I'll start another as I have more questions.

      Thanks!

      DJ

      Author's profile photo Former Member
      Former Member

      Hi Midhun

      Thanks for the detailed documents, Have quick question

      1.How can i set the username and password  ?

      2.How i can give My trail server IP in my  android code

      Thanks

      Raja

      Author's profile photo Midhun VP
      Midhun VP
      Blog Post Author

      You can find that code inside Login.java class. A download link is provided in last part.

      Author's profile photo Former Member
      Former Member

      HI Midhun,

      I am using 30 days trail cloud server for SMP3.0. Since am new to SAP, Please guide me on this.

      1. I configured the odata in my local sever

      You can access SMP 3.0 Admin UI here: https://<localhost>:8083/Admin

      Username: smpAdmin

      Password: s3pAdmin.

      2.Download the sample code in my machine not local server ..while try to run the application am not able to hit the server and not able to register it.

      My code:

      String returnMsg = "success";

        try

              {

        mApplication.setUsername("hello");

        mApplication.setPassword("world");

        ClientConnection clientConnection = new ClientConnection(getApplicationContext(),"com.test.android",null,"SAPsecurity2",

        mApplication.getRequestManager());

        clientConnection.setConnectionProfile(true," 69.195.213.202 ","8083", null, null);

               UserManager userManager = new UserManager(clientConnection);

               userManager.registerUser(true);

               String appCID = userManager.getApplicationConnectionId();//Get Application ID created

               Global.setappCID(appCID);

      Please help me out on this, While register application backend tab i tik All anonymous access and give the user name as "hello" and password as "world". This is right way else guide me ..

      Anticipating your reply.

      Raja

      Author's profile photo Midhun VP
      Midhun VP
      Blog Post Author

      The example I given is not based on anonymous access. But you can do that too, provide the username and password of your GW (formerly NWGW) while creating application in SMP cockpit. The IP of SMP trial server is dynamic, a google search gives you the IP "what is my ip".

      If you are not using anonymous access option you can pass the GW credentials from device code:

      mApplication.setUsername("P218746482");

        mApplication.setPassword("Initial123");

      Author's profile photo Former Member
      Former Member

      HI Midhun,

      Thanks for your prompt reply, While running the code am getting timed out error message.

      Below is my code for hit the sever , I followed your steps and configured the odata as per your example.

      Am not aware about the Cookpit ?  Did i need to configure any thing in Cookpit ?I just made all configuration in Admin which provided by SAP for 30 days trail server. and run the code in my machine not from the trail server ..Please guide me ...

      I Tried with port no:8083 too, Still am getting error

      Your help much appreciated

      mApplication.setUsername("P218746482");

        mApplication.setPassword("Initial123");

        ClientConnection clientConnection = new ClientConnection(getApplicationContext(),"com.test.android",null,"SAPsecurity2",mApplication.getRequestManager());

        clientConnection.setConnectionProfile(true,"69.195.213.202","57954", null, null);

               UserManager userManager = new UserManager(clientConnection);

               userManager.registerUser(true);

               String appCID = userManager.getApplicationConnectionId();//Get Application ID created

               Global.setappCID(appCID);

               appSett = new AppSettings(clientConnection);

      Screenshot_2014-06-29-18-16-40.png

      Author's profile photo Utsav Chobe
      Utsav Chobe

      Hello Raja,

      I faced the same issue, while trying to implement the example. Reason was when I was not using correct values in the statement :

      clientConnection.setConnectionProfile(true, "66.175.100.29", "8080", null, null);

      I used the overloaded method

      clientConnection.setConnectionProfile("<URL TO SMP SERVER>").

      Once the URL was right, it worked for me.

      URL is exactly the one that brings to the screen as the below snapshot (but without the string "/Admin") :


      /wp-content/uploads/2014/06/homepage_486559.png

      I hope it helps you as well.

      - Utsav Chobe

      Author's profile photo Midhun VP
      Midhun VP
      Blog Post Author
      • The credentials I given is dummy you can't use it in your code, you have to use your GW (formerly NWGW) credentials instead to make it work.
      • The IP of SMP trial is dynamic. So each time you need to find the IP of SMP trial; Close browser in SMP server > Run browser again> find the IP. You can ping the IP from your system (where you are testing app) , to make sure that the IP is accessible.

      Midhun VP

      Author's profile photo Utsav Chobe
      Utsav Chobe

      Hello Midhun,

      • Firstly, thank you very much for taking this effort to put in a pretty comprehensive article. It gave a good "Hello World" kind of kick start to begin with SMP. Also, it sets a nice perspective on what kind of behaviour/structure SMP3 SDK is.
      • Additionally, for implementing the example, I had to deviate a bit from the instructions mainly for authentication bit : I am using the cloud trial version of SMP Server. I did not get an option of HTTP/HTTPS Authentication and used SAP SSO Authentication. Snapshot below

      Authentication Tab.png

      • Also, I just changed the argument in the statement " clientConnection.setConnectionProfile(true, "66.175.100.29", "8080", null, null);"

              and used overloaded method

              clientConnection.setConnectionProfile("https://smpxxxtrial.hanatrial.ondemand.com")

              to suit my environment.

      (I believe this is the expected change)

      Thanks again for this blog!

      - Utsav Chobe

      Author's profile photo Midhun VP
      Midhun VP
      Blog Post Author

      The given example is based on  on premise version of SMP trial not the cloud version of SMP. You tried the solution with SMP cloud version. Since the Odata SDK is common for both it worked for you with few changes.

      Midhun VP

      Author's profile photo Utsav Chobe
      Utsav Chobe

      Ok, that explains the difference. Also, explains the fact that the bit of the change done to make the example work was required to suit the cloud version of trial SMP server.

      Thanks again for the article! Was a help!

      - Utsav Chobe

      Author's profile photo Midhun VP
      Midhun VP
      Blog Post Author

      You found a way to run the app with SMP cloud too. Cool 🙂 .

      Author's profile photo Former Member
      Former Member

      HI Midhun

      Still am not able to reach the back-end system. While ping the Application am getting following error. And Same time  kindly requesting.If would share me some tips how to store the your(Odata) list in android local database.

      Thanks Midhun

      Kind Regards

      Raja

      Capturess.PNG

      Author's profile photo Former Member
      Former Member

      HI Midhun,

      Thanks i  successfully run the code, Once again thanks lot...

      Have quick question.

      1. How can i send push notification?

      2.How can i bring dynamic user?

      3.How can i configure any SOAP data into Odata?

      4. Any Additional features in SMP3.0 Please send  useful link..

      Thanks for consideration Midhun...

      Kind Regards

      Rajasekaran

      Author's profile photo Former Member
      Former Member

      Hi CHobe.

      Am facing the same problem "Additionally, for implementing the example, I had to deviate a bit from the instructions mainly for authentication bit : I am using the cloud trial version of SMP Server. I did not get an option ofHTTP/HTTPS Authentication and used SAP SSO Authentication. "

      If addressed the issue please explain me.

      Kind Regards

      Raja

      Author's profile photo Midhun VP
      Midhun VP
      Blog Post Author

      Hi Rajasekaran,

      What is the issue you are facing ?

      If you are using SMP HANA on cloud, the change you need to do are: configure SAP SSO Security instead of HTTP/HTTPS Authentication and replace clientConnection.setConnectionProfile(true, "66.175.100.29", "8080", null, null); with clientConnection.setConnectionProfile("https://smpxxxtrial.hanatrial.ondemand.com") in the source code I provided.

      Regards,

      Midhun VP

      Author's profile photo Former Member
      Former Member

      HI Midhun,

      Followed the same but seems like am not able to reach the back end, Got message "Devices registered successfully" ... After that While clicking the Get data button loading long time not able to reach the backend.

      For your reference i have attached the back-end connection properties 

      Kind Regards

      RajaCapture.PNG

      Author's profile photo Midhun VP
      Midhun VP
      Blog Post Author

      Under authentication type can you select Internet instead of Onpremise and try.

      Author's profile photo Former Member
      Former Member

      HI Midhun

      Still am not able to reach the back-end system. While ping the Application am getting following error. And Same time  kindly requesting.If would share me some tips how to store the your(Odata) list in android local database.

      Thanks Midhun

      Kind Regards

      Raja

      Capturess.PNG

      Author's profile photo Midhun VP
      Midhun VP
      Blog Post Author

      Hi Raja,

      I believe that you missed some configuration while creating app in SMP Admin Cockpit. You need to select option "internet" after providing end point URL and authentication URL. I just checked again and it is works fine.

      Regarding storing data in device, you can use SQLite DB in Android to store the data. You can find many examples in web on how to use SQLite DB with Android.

      Regards,

      Midhun VP

      Author's profile photo Former Member
      Former Member

      HI Midhun/ Kansal

      Thanks for your support, Now i can able to connect the back-end successfully. Regrading Local storage in my mobile is there any option in odata sdk to store the received data in my local database.

      Kind Regards

      Raja 

      Author's profile photo Jitendra Kansal
      Jitendra Kansal

      Rajasekaran G

      Please raise a new thread regarding your any other queries.

      Author's profile photo Jitendra Kansal
      Jitendra Kansal

      Rajasekaran G

      Under "Backend" & "Authentication" tab you should select "Connect to" as "Internet" because  it will tell SMP server (cloud)  where your service can be found.

      Are you still getting same error after doing this change?

      Author's profile photo Former Member
      Former Member

      I cant' register my device on smp,i get error : connection timeout.
      The credentials are of GW demo system or the SMP3 credentials to log on?

      I put my public ip and port 8080 to make the connection but i checked the port and is closed and also i get request time out when i ping my public ip.Any help is useful.

      Thank you! I use smp on-premise.

      Author's profile photo Midhun VP
      Midhun VP
      Blog Post Author

      The credentials are Gateway Credentials (formerly NWGW). You should be able to access the SMP server using its public IP, and make sure 8080 port is open to run the app.

      Midhun VP

      Author's profile photo Former Member
      Former Member

      i can see in task manager the port is busy by java.exe and is closed  what should i do ?

      Author's profile photo Midhun VP
      Midhun VP
      Blog Post Author

      You should open the port .

      Author's profile photo Former Member
      Former Member

      Hi Midhun:

      I have created a local oData service that can be accessed without user and password. My SMP installation is local as well. I am using the Integration Gateway to expose the service.

      I try to follow your code but I always get "Error:80003, connection refused" on the emulator, while registering.

      I've checked the ports are open and I have tried both initialization methods, with full parameters:

      clientConnection.setConnectionProfile(true, "127.0.0.1", "8080", null, null);

      And just the url

      clientConnection.setConnectionProfile("http://127.0.0.1:8080");

      What are the user/password that I must provide if the backend service does not require one?

      Thanks!

      Author's profile photo Midhun VP
      Midhun VP
      Blog Post Author

      Hi,

      If you have an Odata service ready you don't need to use Integration gateway. You can use the Odata service to configure the app as I did.

      Make sure the Odata service you created is working without credentials. You can run the service in a web browser and check.

      Please provide the steps you followed in admin cockpit to configure the app.

      Regards,

      Midhun VP

      Author's profile photo Former Member
      Former Member

      Hey Midhun, thanks for the reply.

      It's working now.

      I have a SQL database and I created the Odata service using the Integration Gateway. I can access the service on the browser:

      http://192.168.28.175:8080/gateway/odata/sap/EspmService;v=1/

      I created the Application:

      Screen Shot 2014-08-20 at 11.17.49 AM.png

      And the authentication is set as "No authentication challenge", under a profile named "sap".

      Control flag optional, check impersonation ok.

      So I managed to register my device. Turns out it was a ports/firewall/ip issue. Now I can see the registration. Also the data is being displayed on the device.

      I didn't have to use any credentials anywhere since it was all without authentication.

      Thanks for your help!

      Alejandro