Register your device with SMP 3.0 and test your Hybrid App (Kapsel / Sencha Touch)
|Part – 1||Part – 2||Part – 3|
|Click Here||Click Here||Click Here|
This is Part 2 of the entire Overview, if you miss First Part on how to create mobile App in SMP, please click here
In our previous session we’ve covered how to create an SMP App in the console, now we will connect a device to our Application in SMP, This step will register our device in the server, and we can monitor the performance, requests and response from the Server console.
we can use Google Chrome REST Client for Device registration
For now we will test all our work from the Google chrome browser, please note that all our development involved in here use AJAX /CORS requests, so we will use Google chrome or Safari browser with web security disabled option (There is lot of help available on how to disable web security in internet, for now we are not covering that portion here)
I’ve used PostMan – REST Client for the registration purpose. There are several plugin which this job, it’s really up to you to choose your convenient plugin as REST Client.
URL: http://SERVER.vm.cld.sr:8080/odata/applications/latest/com.pavan.sales/Connections – Note that we’ve created com.pavan.sales earlier, so we need to use the same package name.
Headers: Content-Type – application/xml
Body (Choose RAW) and paste the following
<?xml version=”1.0″ encoding=”utf-8″?>
<entry xmlns=”http://www.w3.org/2005/Atom” xmlns:m=”http://schemas.microsoft.com/ado/2007/08/dataservices/metadata” xmlns:d=”http://schemas.microsoft.com/ado/2007/08/dataservices“>
Take a note at above body, we are registering as iPhone device.
Now Send. If everything goes well you will get 201 as response code, if you get 200 as response then your request is fine but connection has not been created at the server. If you get any other then something went wrong, you can check the application logs in the Console.
Path to check the SMP Server Logs:
- Goto Logs->Application Log
- Change the Log type to ALL
- Choose the date time range and Submit
You will see the our request made to the server and it will assign unique Registration ID for our request
Now Switch over to Application->Registrations, you will see that your device has been registered and shown as iPhone
Now you’ve successfully registered the device.
Test your SMP App
Now open the following URL in google chrome or Safari (If you see any error/issue, try clear your cookies and try again)
You will see all available services provided by the Demo system.
The following services are available in the NW Demo system, in our example we will these services to build our POC Application.
You need to append this service name to the main app URL, as an example if you want to see Sales Orders following will be your URL
Please note: Try to limit your data fetch in to Mobile Devices, you need to use Paging to limit the bandwidth usage on the mobile device.
You can track your application usage from the Server Dashboard, for the requests and detailed log also available
Now we are done the SMP Application, Back end and Device registration. And we’ve our Service URLs to call to fetch the data.
We will continue the Sencha Touch Coding and Cordova wrapper in the next session
Hi Pavan Kothapalli
I Have small doubt, I don't want use user name and password while creating Application(anonimas)
I want to use user name and password dynamically.In this case what i need to do?
When you are defining security in SMP Cockpit you have options like HTTP/HTTPS, x.509 certificate etc. You can choose from that. Based on that authentication happens. I am using HTTP/HTTPS authentication in this example, Developing SMP 3 Mobile App using Appbuilder, Kapsel and SMP 3 Trial - Part 1
Thanks for reply,
I followed steps and created application and i pinged from SMP, It is pinging successfully .
When i am trying in postman plug in with the netweaver gateway password and user name. It is returning with 401 Unauthorized error.
As mentioned in your link, i din't check the check box use system proxy while creating Application in SMP.
In the following screen com.oteint.GS1.LeadCreate is the application name created in SMP3.0
You need to pass the credentials based on the security you set for the application you created. Ex. In my blog I used an Odata service exposed from GW system so I am passing the GW credentials for the request. Similarly based on the security you configured you need to pass the credentials.
Thanks Now it is working,
Suddenly it started working..
I have small doubt, even though i am giving correct user name and password in the plugin, again popup is coming for asking user name and password, if i give again then data is coming.
May be you have saved wrong credentials. Close the plugin/browser and check again.
When you are using "Allow anonymous access" option you should provide the credentials during configuration (available below the Allow anonymous access check box ). This option is provided when the user don't need to enter the credentials. So when a request is made by the user the saved credentials will be used and get e response with data.
But you are using the "Allow anonymous access" option without providing the credentials, that's why you are getting this error.
Hi Midhun VP
If i won't tick "Allow anonymous access", i can't able to register the user and get the data from back-end.
Actually my requirement is, it should take back-end credentials (gateway) to get the data.
Now i removed "Allow anonymous access"
It is continuously asking back-end (gateway) credentials in postman plugin.
i checked the gateway URL in browser, its working fine, I ping the application from SMP it is pinging successfully .
But in SMP i can see log of the application in green color
I am not sure about the behavior of the postman client. But when you develop the app this will not happen. Since your requirement is registration using dynamic credentials, do not check the "allow anonymous access" option and configure the app in SMP cockpit. It will work as expected in the mobile app.
Can you share some to guide to build cordova or kapsel using x.509 certificate secuirty configuration to check sso and also how to test the app in rest client.urgently need any help.