Developer

SAP Business Application Wizard Tutorial

This tutorial guides you through developing a Native OData Windows Application and its SAP Cloud Platform mobile service for development and operations (HCPms) counterpart using the SAP Business Application wizard in Visual Studio.

Context

Beginning with SAP Mobile Platform SDK version 3.0 SP14 the wizard of the SAP Business Application project template for C# allows the developer to perform some HCPms administration, including listing and creating HCPms applications. Administration capabilities of the wizard supports the most common, but not all, scenarios. Administration is performed using a HCPms administration service that may not be available on every HCPms server instance. SAP Moble Platform (SMP) servers do not support this administration service in this release and therefore cannot use the wizard's administration features to administer SMP servers. To define special properties, edit or delete an existing application the developer must use the Management Cockpit.

Procedure

  1. In Visual Studio create a new project by selecting Start of the navigation path File Next navigation step New Next navigation step Project End of the navigation path.
  2. In the "New Project" dialog choose Visual C# language on the left side, scroll to the bottom on the right side that lists the available project templates for the given programming language, and choose the SAP Business Application project template. Click OK:



    After selecting the project template the business application wizard displays:




  3. Create a new HCPms application on the server-side. Click Onboarding on the left side, and click the "…" button to start the HCPms administration part of the wizard:



  4. If no HCPms server is defined, then add the host of the HCPms server to which you will connect to and create the app on. For example:



  5. Select one of the servers and click Connect.
    The user that gets authenticated automatically by the IDP may not have access to the administration service. If this is the case an error screen displays. Selecting Get detailed information reveals the exact issue, for example, HTTP/403-Forbidden. Automatic authentication generally happens when SSO is used. If you need to use different credentials then disable (do not delete) the X509 certificate belonging to your user. You need to do this only once:
    1. Open certmgr.msc
    2. Expand Start of the navigation path Personal Next navigation step Certificates End of the navigation path
    3. On the right side select the certificate that is issued to your user and the intended purpose of "Client Authentication":

    4. Right-click the certificate and select Properties:

    5. In the properties window click Disable all purposes for this certificate, then click OK:

    6. Delete the WinINet cookies and cache (you might need to do this several times, for example if you authenticated yourself against the IDP using your user id or your certificate and want to switch to using a different user, for example a P-user):
      1. Open inetcpl.cpl:
      2. Click Delete under "Browsing history"

      3. From the "what to delete" list select only Temporary Internet files and website files and Cookies and website data, then click Delete:

    After successfully authenticated with a user, the list of available applications displays on the selected HCPms server:


  6. Either create a new HCPms application or use an existing HCPms application:
    • To create a new HCPms application select the "+" icon on the bottom-left corner.

      With this example you can create a simple working HCPms application on the server whose primary connection uses a publically available demo OData service. The "HCPms application wizard" dialog opens and can be used to create a new application on the HCPms server.

      1. On the "General" page enter the following information:
        • Application identifier: com.sap.products
        • Application name: com.sap.products
        • Vendor name: SAP


      2. On the "Security" page:
        • Change the Security configuration from "None" to "Basic"
        • Uncheck Enable protection against Cross-Site Request Forgery (CSRF), otherwise registration from the generated application fails.

      3. On the "Connections" page you can define the service you wish to use via the HCPms application. In our case it is a simple, publicly available OData demo service: http://services.odata.org/V3/OData/OData.svc/Information published on non-SAP site:
        1. Click the "+" icon to define a new connection.
        2. In the "New Backend Connection" dialog just enter the "http://services.odata.org/V3/OData/OData.svc/" URL into the Backend URL field and then click OK:

        Your "Connections" page should look like this:

      4. Click Create to create the application on the HCPms server.
      5. If the application is created successfully then the application ID on the "Onboarding" page of the wizard changes to the one you entered (in our case: com.sap.products). If you open the optional features the Host and Port fields should also contain values (the server host and port on which the HCPms application was created):

    • To use an existing HCPms application: select one in the list and click Select. The application ID, the Host and Port fields are automatically populated with data.

      From this point creating a client application for an HCPms application is the same whether you have created a new HCPms app or are using an existing one.

  7. Click Finish to generate a working application.
  8. Once the application is built and starts, the registration window (.NET) or the registration page (Store Apps/UWP) displays. This tutorial uses screenshots from the .NET version, however the steps are identical regardless of application type.
    1. On the Logon screen: - Enter the user name and password to the User and Password fields (since the Basic security configuration was selected earlier):

    2. Click Register.
    3. After successful registration, either enter a passcode or uncheck Enable passcode and click OK:

    4. When the application opens, select Products from the Entity sets combobox:

  9. To edit or check the HCPms application you created in Visual Studio, enter the admin UI URL (usually the URL is the same that is defined in the wizard) in a browser.
    1. Click the Applications tile:

    2. Filter the list of applications using the application id of the HCPms application you created in Visual Studio. Click the wheel icon that belongs to the application then the Configure menu item.

    3. Browse to the application properties: