Skip to Content
Author's profile photo Pavan Kothapalli

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.

Device Registration

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.

Parameters:

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.

Method: POST

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“>

<content type=”application/xml”>

<m:properties>

<d:DeviceType>iPhone</d:DeviceType>

</m:properties>

</content>

</entry>


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

/wp-content/uploads/2014/05/smp_application_log_folder_463617.jpg

You will see the our request made to the server and it will assign unique Registration ID for our request

/wp-content/uploads/2014/05/smp_device_registration_463618.jpg

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)

http://SERVER.vm.cld.sr:8080/com.pavan.sales/

/wp-content/uploads/2014/05/smp_nw_gateway_xml_response_services_463619.jpg

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.

  • SalesOrders
  • SalesOrderItems
  • Products
  • BusinessPartners

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

http://SERVER.vm.cld.sr:8080/com.pavan.sales/SalesOrders


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.



Application Usage

You can track your application usage from the Server Dashboard, for the requests and detailed log also available

/wp-content/uploads/2014/05/smp_application_usage_tracking_463620.jpg

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

Assigned Tags

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

      Hi Pavan Kothapalli

      Nice Document,

      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?

      Thanks

      Suresh Babu

      Author's profile photo Midhun VP
      Midhun VP

      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

      Midhun VP

      Author's profile photo Former Member
      Former Member

      Hi Midhun,

      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

      Untitled.png

      Author's profile photo Midhun VP
      Midhun VP

      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.

      Midhun VP

      Author's profile photo Former Member
      Former Member

      Dear Midhun,

      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.Untitled.png

      Thanks

      Suresh

      Author's profile photo Midhun VP
      Midhun VP

      May be you have saved wrong credentials. Close the plugin/browser and check again.

      Author's profile photo Former Member
      Former Member

      • , we are giving Netwaver Gateway URL in connection profile and this URL is working fine in browser with Gateway credentials.
        I check the check box "Allow anonymous access" in application and I didn't give any user name and password , then user got resisted and when I am calling the application for data using phostman plugin, It is asking continuously Netweaver Gateway credentials, even though I am giving correctly and following error log we are getting in SMP.

        But if I check "Allow anonymous access" and give the credentials in Application SMP, it is fetching data from back end.

        Please help us in, how to move further?

        Note: Netweaver Gateway(GS1), SMP serves and my PC all are in local network
        and from my PC I can ping both servers. and we given Netweaver server certificate in SMP trust key store.

        Error Log

        <html><head><title>Logon Error Message</title><META http-equiv="Content-Type" content="text/html;charset=UTF-8"><style type="text/css">body { font-family:tahoma,helvetica,sans-serif;color:#333333;background-color:#FFFFFF; }td { font-family:tahoma,helvetica,sans-serif;font-size:70%;color:#333333; }h1 { font-family:tahoma,helvetica,sans-serif;font-size:160%;font-weight:bold;margin-top:15px;margin-bottom:3px;color:#003366; }h2 { font-family:verdana,helvetica,sans-serif;font-size:120%;font-style:italic;font-weight:bold;margin-top:6px;margin-bottom:6px;color:#999900; }p { font-family:tahoma,helvetica,sans-serif;color:#333333;margin-top:4px;margin-bottom:4px; }ul { font-family:tahoma,helvetica,sans-serif;color:#333333;list-style-type:square;margin-top:8px;margin-bottom:8px; }li { font-family:tahoma,helvetica,sans-serif;color:#33333;margin-top:4px; }.emphasize { color:#333333;background-color:#C8E3FF;padding:5px;}.note { color:#CC6600; }a { font-family:tahoma,helvetica,sans-serif;text-decoration:underline;color:#336699; }a:visited { color:#001166; }a:hover { text-decoration:none; }</style></head><body><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td><h1>Logon failed</h1><br><h2>What has happened?</h2><p>Call of URL http&#x3a;&#x2f;&#x2f;sapbi02.XXXXX.com&#x3a;8000&#x2f;sap&#x2f;opu&#x2f;odata&#x2f;sap&#x2f;Z_LEAD_CREATE_SERVICE&#x2f; terminated due to error in logon data.</p></td></tr><tr><td> </td></tr><tr><td class="emphasize"><strong>Note</strong><br>Logon performed in system GS1. No logon data provided.</td></tr><tr><td> </td></tr><tr><td><p>  </p><h2>What can I do?</h2><ul><li> If you do not yet have a user ID, contact your system administrator. </li></ul></br><p class="note">Error Code&#x3a; ICF-LE-http-c&#x3a;001-l&#x3a;E-T&#x3a;-C&#x3a;5-U&#x3a;-P&#x3a;-L&#x3a;7-X&#x3a;00155D01B3311ED3BFA660455D2679C2_00155D01B3311ED3BFA66045584299C2_1-x&#x3a;0233FDE3E92AF13899C200155D01B331</p></br><p> HTTP 401 - Unauthorized</br><p>Your SAP Internet Communication Framework Team</p></td></tr></table></body></html>\

        Note: Earlier it worked because we added proxy in SMP pron.ini file.
        But my network administrator telling it's not mandatory to add proxy, hence he removed the same.

        Thanks
        Suresh Babu
      Author's profile photo Midhun VP
      Midhun VP

      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.

      Midhun VP

      Author's profile photo Former Member
      Former Member

      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



      Thanks

      Suresh

      Author's profile photo Midhun VP
      Midhun VP

      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.

      Midhun VP

      Author's profile photo Former Member
      Former Member

      hi Pavan,

      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.

      Regards,

      Saurabh