With the availability for HTML5 applications on trial landscape and Rui Nogueirablog post we decided to try it out for our ESPM webshop scenario. As we already had destinations present in the ESPM scenario and we had separate folders for ui code, it was a breeze to get our ESPM webshop application running on the cloud (with some minor tweaks ). You can check out the running application here.
We basically followed Rui's blog step-by-step replacing the destinations and ui code with out stuff wherever necessary. Also, going with the times we modified the theme of our application to follow blue crystal.
This minor changes required us to modify a few files, so we decided to create a new branch in our public github space so others don't have to worry about the modifications.
Prerequisites
So, before we move on to how to get the code and get this application running some prerequisite checks.
1. Check that you are able to access following service, this service will be used to fetch the data (OData) and images in our application
https://cloudmodelespmhana.hana.ondemand.com/espm-cloud-web/espm.svc/
2. Create a trial account on SAP HANA Cloud Platform. If you don't have it already, you can register for free here
https://help.hana.ondemand.com/help/frameset.htm?65d74d39cb3a4bf8910cd36ec54d2b99.html
3. Install latest version for Eclipse Kepler (SR2 used for this scenario). You can find the latest release here
http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/keplersr2
Obtaining the code for this app
As mentioned above we have created a separate branch in out github space to help others run this application quickly.
- Download the code as a zip file from https://github.com/SAP/cloud-espm-scenarios/archive/scenario-html5.zip
- Unzip and check the contents.
- There should be a ReadMe file which has the exact same steps as mentioned here. Also, there will be two folders.
- "destinations" folder contains the destinations for the OData service and the images.
- "webshop-ui" folder contains the webshop ui code modified for this scenario.
Define destinations in your cloud account
- Navigate to the cockpit in your trial account, or copy paste this url in your browser https://account.hanatrial.ondemand.com/cockpit
- Click on Destinations tab, then click New Destination
- Click on Import from File and select the cloudbackend file in the destinations folder you downloaded above.
- Save the destination once it is uploaded.
- Repeat step 3 to step 5 for cloudbackendimages file
Create ESPM Webshop HTML5 application
- Navigate to the cockpit in your trial account, or copy paste this url in your browser https://account.hanatrial.ondemand.com/cockpit
- Click on HTML5 Applications and then click on New Application
- Provide "espmwebshop" as the Application name. (You can provide any other name also)
- Click Create.
- Click on "espmwebshop"
- Your application is now created and ready for use.
Clone git repository in Eclipse
- Once you have completed the above step click on Development tab in the left pane.
- Under "Source Location" copy the Git Repository Link
- It should be something like https://git.hanatrial.ondemand.com/<pNumber>trial/espmwebshop
- Start Eclipse and switch to the Git perspective
- Under Git Repositories, click on "Clone a Git Repository"
- Paste the Git-URL you've copied in step b above into the URI field of the popped-up window, provide your user name and password of your SAP HANA Cloud Platform trial account into the fields User and Password, click on Next, click on Next again and click on Finish.
- Check your connection settings, (proxy in Eclipse) if any of the above steps fail
- You should now have an empty repository configured in your Eclipse.
Copy and upload code to repository
- Once you have completed the steps above, right click on the Git repository and select the command Import Projects.
- Select Import as general project, click on Next (note the name of the project) and after that click on Finish.
- Switch to the Web perspective in Eclipse
- Copy all the files and folders inside webshop-ui folder from this branch.
- Right-click the project you just created and select Paste
- Now you have copied all the UI code into your project
- To upload the code to the git repository right-click your project
- Select Team -> Commit
- Write a short Commit message
- Select all files (Select-all button is on the right hand side of the "Files" panel)
- Click "Commit and Push"
- Provide your credentials if prompted
- You should get a success message with the git repository link.
Version your code and Activate application url for public access
- Navigate to the cockpit in your trial account, or copy paste this url in your browser https://account.hanatrial.ondemand.com/cockpit
- Click on HTML5 Applications.
- Click on "espmwebshop" and select Development.
- You should be able to see the commit message you gave above.
- You should also be able to see your destinations under "Required Destinations"
- The status for the destinations should be green, indicating they are present in the account.
- Click on the commit message and the Webshop application should open up in a new tab.
- In the list of Available Commits select the commit message and click on the "Create Version" icon at the right end of the line.
- Provide a version name 1.0 and click on Add
- Now switch to the Version Management tab
- You should see the version you've just created before
- Now click on the icon at the right end of the line to Activate this application version
- You will get a message telling you that the version has been activated and that the Changes will be effective after (re)-start of the application.
- Confirm the question if you really want to do this with by clicking on Yes.
- Switch to the HTML5 Application Dashboard tab and click on the Application Url
- This is the URL using which others can now access your app.
So, now you should have a running application which accesses data from the ESPM cloud backend.
Ankur