Skip to Content

About the Mobile Backend Generator

If you haven’t heard already, there’s a brand-new way to create and deploy an OData service, using the Mobile Backend Generator. The Mobile Backend Generator is a set of tools included with SAP Web IDE that interacts with SAP Cloud Platform Mobile Services. These tools are now available to customers with the latest release of the Mobile Development Kit (MDK) on SAP Web IDE for trial or preview landscapes. You’ll need to create a trial account to use this new feature, if you don’t have one already.

This blog walks you through generating and deploying an OData service to the Neo or Cloud Foundry landscape. Even if you plan to deploy to Neo, you require a Cloud Foundry account as well.  Cloud Foundry provides the builder service for the Mobile Backend Generator.

About the MDK

MDK is a feature of SAP Cloud Platform Mobile Services. If you’re new to MDK and want to learn more about developing apps without having to do much coding, you might want to begin by going through this Learning Journey and these helpful videos.

Setting Up Your Environment

Ensure that the SAP Web IDE Full-Stack is enabled.

Select the box and under Take Action, select “Go to Service”.

Select the gear in the left menu (1) and select “Features” (2). Make sure that “Mobile Development Kit Editor V master” is On (3).

Select “Cloud Foundry” (1), verify that you have a builder installed (2) and that it is up to date. When the installation or update is complete, select “Save” (3). I missed this and wondered why I couldn’t continue!

Generating an OData Service

Select the “</>” symbol (1) to enter your workspace. Right-click your workspace folder, select “New” (2)  then “Project from Template.”(3)

Change the Category to “All categories” (1) and select “Mobile OData Service Project.” (2) Select “Next.” (3)

Provide a project name (1), then select “Next.” (2).

Provide a service app name (1) and the version (2). Here, for simplicity, I’m using an in-memory database (3), a deployment target of Neo (4) and “None” (5) as the authentication mode. Select “Finish” (6) when done.  See Generating an OData Service for choices other than in-memory database.

Add a model to your project by importing a CSDL (Common Schema Definition Language) file that you’ve previously created. Right-click your project folder (1), select “Import” (2), then “File or Project.” (3)

When you see the import screen, browse to the location of your csdl.xml file (1), then select “OK”. (2)

Next, you’ll see a visual representation of your CSDL file. You can use our CSDL graphical modeling tool to create or modify an existing csdl.xml file. This tool is currently available in preview mode.

You can create your own csdl.xml file if you don’t already have one. Right-click your project folder, (1)  and select “New” (2), then select “OData CSDL Document.” (3)

You can use either OData Version 2.0 or Version 4.0 (1). Please see Overview for OData versions to help determine what version is correct for you. Provide a schema namespace (2) and a namespace alias (3), then select “Create” (4). The file name is generated automatically from the schema namespace.

Double-click the csdl.xml file to use the graphic editor to graphically create your model. Remember to save your changes!

Right-click your csdl.xml file (1), select “Generate Mobile OData Service” (2) to generate the OData service.

The srv (service) folder now contains new files and folders. Right-click your srv folder (1),

select “Build”(2)(3) .

The target folder now contains an odata-service-version#.war file.

Deploying the Generated Service to Neo

Right-click your generated war file in the target folder (1) , select “Export.” (2) This saves the file locally.

Since you cannot deploy to Neo from Web IDE, move to the SAP Cloud Platform cockpit of your Neo landscape. Select “Tools” (1) from the top menu and select “SAP Cloud Platform Cockpit”. (2)

Once you’re in the cockpit, go to “Applications” (1) then “Java Applications,” (2) then select “Deploy Application”. (3)

Browse to the war file you exported (1) and enter an application name (2) (this is the name that will display in Neo). Select the runtime “Java EE 7 Web Profile TomEE 7.” (3) When done, select “Deploy.” (4)

When the deployment completes, select “Done”. Don’t start the service yet.

Select the service name.

Since this blog used the in-memory database and None as authentication method options, select “Start”. Otherwise, you’ll need to bind your database to your application.

Once the service starts, you see its URL in the Application URLs.

Select this link to access your OData service and make sure it works from a browser.

Deploying the Generated Service to Cloud Foundry

Even though I chose Neo as the deployment landscape, I’ve added the instructions to Cloud Foundry because they are simple!

You can deploy your application to Cloud Foundry from Web IDE. Right-click on your project folder (1) and select “Build” (2), then “Build.” (3)

Right-click on the srv folder (1), select “Run” (2), then “Run as Java Application” (3).

Once the app is deployed, you’ll see a URL just above the console.   You can test and debug your service within Web IDE.

Select the link to access your OData service and make sure it works from a browser.

Now you are ready to use your newly generated OData service by building a mobile app with SAP Cloud Platform SDK for iOS,  SAP Cloud Platform SDK for Android, MDK or SAP Mobile Cards!

I hope you enjoyed my first blog!

 

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Jayakrishnan Chandramohan

    Hi,

    I didn’t understand the below step. Where do i create my model or csdl.xml file? Is this blog have any parent blog in which i can refer this step? Please help me on this.

    Add a model to your project by importing a CSDL (Common Schema Definition Language) file that you’ve previously created

     

    Thank you,

    Regards,

    JK.

    (0) 
  2. Lana Turner Post author

    Good day JK,

    This blog is not part of another blog.  This step assumes that you have a pre-existing csdl.xml file.

    The following step shows you how to create an csdl.xml file but doesn’t get into the detail.  Sounds like something that we should blog about.  This is something we have discussed.  I will document the process.

    Lana

     

     

    (0) 
  3. Anton Orlov

    Hi Lana, congrats with your first blog! I find the article very inspiring.

    Does the method described allow to create oData services with creation/deletion functions and not only read?

    Regards, Anton

    (0) 
    1. Martin Lacasse

      Hi Anton,

      The service we generate supports the full Create, Update, Delete operations without requiring any extra coding.  If you want to implement actions (OData V4) or Function Imports (OData V2), we would generate the stubs, but then you would have to code the business logic.

      Our generated code has extension points to add any custom logic outside of the generic CRUD service we generate.

      thanks

      Martin

      (1) 
      1. Anton Orlov

        Thanks for the answer, Martin! It definitely makes me even more interested in this tool. Meanwhile I have one more question if you don’t mind.

        What’s the reason why you call it “Mobile” backend generator? Are there any limitations which don’t allow me to use this tool for my Fiori applications rather than mobile apps?

        Regards, Anton

        (0) 

Leave a Reply