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:
Define backend connection. I am using an existing Odata service from Gateway trial system: http://sapes1.sapdevcenter.com:8080/sap/opu/odata/iwbep/gwdemo/
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.
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.
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
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
Thanks JK! That worked! Sorry for hijacking the thread, I'll start another as I have more questions.
Thanks!
DJ
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
You can find that code inside Login.java class. A download link is provided in last part.
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
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");
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);
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") :
I hope it helps you as well.
- Utsav Chobe
Midhun VP
Hello Midhun,
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
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
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
You found a way to run the app with SMP cloud too. Cool 🙂 .
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
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
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
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
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
Raja
Under authentication type can you select Internet instead of Onpremise and try.
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
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
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
Rajasekaran G
Please raise a new thread regarding your any other queries.
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?
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.
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
i can see in task manager the port is busy by java.exe and is closed what should i do ?
You should open the port .
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!
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
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:
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