Tutorial: Displaying additional UserData in mobile native applications
In the Tutorial: Extending a search profile to retrieve and display custom data in the storefront tutorial, you learned how to create more catalog data warranty and display it in the storefront by using the search-based catalog navigation noun. The purpose of this tutorial is to show you how to display the custom UserData Warranty in a mobile native application by using REST service.
REST services are built on top of OAGIS services. REST services use an access profile and XPath to get data from an OAGIS noun. The access profiles that are used by REST services are defined in a configuration file wc-rest-resourceconfig.xml. In this scenario, you need to extend the configuration file wc-rest-resourceconfig.xml to specify your custom access profile so that you can retrieve the custom user data.
Next, you extend the existing sample Android native application. You learn to work with the application code by adding a table row for warranty on the product display page to view related warranty information.
To add this new capability, there are several areas of the Android application where you must update code. First, you must extend the Product object and JSON parsing code to capture the related user data. This information is returned by the REST service but is not currently stored in the application. Next, you add a table row to the product display page to show the related product warranty information. To implement the new table row, you create an activity and provide a layout for the related page. Finally, you add your new activity to the application manifest file.
Developing mobile web application requires that you have an Android development environment setup. If you need instructions to complete this setup, consult the Android installation guide as noted in the System Requirements section of this document.
- REST Services
- JavaScript Object Notation
- Specify a custom access profile to retrieve custom UserData by using REST services
- Extend existing sample Android code to add information about the product page
- Create an activity to retrieve custom warranty data
Time required
Expect this tutorial to take three hours to complete. The tutorial takes longer if you explore concepts that are related to this tutorial.Skill level
This tutorial is intended for advanced WebSphere Commerce developers responsible for customizing the Mobile Native Application. To complete this tutorial, familiarize yourself with the following terms and concepts:- WebSphere Commerce search
- REST service
- XML
- WebSphere Commerce Services
- Rational databases
- SQL
- Mobile Native App
- JsonParser
System requirements
Before you begin this tutorial, ensure that you completed the following tasks:- WebSphere Commerce Version 7
- WebSphere Commerce Developer Feature Pack 4
- Installed separate lightweight Eclipse besides Rational Application Developer for editing Androidcode, for example Eclipse Classic 3.7.2
- Installed latest JDK.
- Installed SDK and ADT plug-in.
Prerequisites
Before you start this tutorial, ensure that you completed the following prerequisites:
- Publish the Deprecated featureMadisons store archive
- Deprecated featurePublish the Madisons enhancements store archive. If the Madisons enhancements store archive is not available for you to publish, you must display additional stores.
- Publish the Deprecated featureMadisons mobile enhancements store archive.
- Deploying the search server
- Setting up the search index
- Complete the lesson Customizing the WebSphere Commerce schema. This lesson creates the XWARRANTY table that contains additional warranty information.
- Complete the following lesson: Extending the search schema. This lesson extends the search schema to support warranty fields and to configure the Data Import Handler to extract data from the relational table. You do not need to complete the full tutorial, only the Extending the search schema and Configuring the Data Import Handler mapping lessons.
- Complete the following tutorial lessons: