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