Product overview > Tutorials, examples, and samples > REST data services sample and tutorial

Use a Java client with REST data services

The Java™ client application uses the eXtreme Scale EntityManager API to insert data into the grid.

The previous sections described how to create an eXtreme Scale data grid and configure and start the eXtreme Scale REST data service. The Java client application uses the eXtreme Scale EntityManager API to insert data into the grid. It does not demonstrate how to use the REST interfaces. The purpose of this client is to demonstrate how the EntityManager API is used to interact with the eXtreme Scale data grid, and allow modifying data in the grid. To view data in the grid using the REST data service, use a web browser or use the Visual Studio 2008 client application.


To quickly add content to the eXtreme Scale data grid, run the following command:

  1. Open a command-line or terminal window and set the JAVA_HOME environment variable:

    • [Linux][Unix] export JAVA_HOME=java_home

    • [Windows] set JAVA_HOME=java_home

  2. cd restservice_home/gettingstarted

  3. Insert some data into the grid. The data that is inserted will be retrieved later using a Web browser and the REST data service.

    If the data grid was started withouteXtreme Scale security, use the following commands.

    • [Unix][Linux] ./ load default

    • [Windows] runclient.bat load default

    If the data grid was started witheXtreme Scale security, use the following commands.

    • [Unix][Linux] ./ load default

    • [Windows] runclient_secure.bat load default

    For a Java client, use the following command syntax:

    • [Unix][Linux] command

    • [Windows] runclient.bat command

    The following commands are available:

    • load default

      Loads a predefined set of Customer, Category and Product entities into the data grid and creates a random set of Orders for each customer.

    • load category categoryId categoryName firstProductId num_products

      Creates a product Category and a fixed number of Product entities in the data grid. The firstProductId parameter identifies the id number of the the first product and each subsequent product is assigned the next id until the specified number of products is created.

    • load customer companyCode contactNamecompanyName numOrders firstOrderIdshipCity maxItems discountPct

      Loads a new Customer into the data grid and creates a fixed set of Order entities for any random product currently loaded in the grid. The number of Orders is determined by setting the <numOrders> parameter. Each Order will have a random number of OrderDetail entities up to <maxItems>

    • display customer companyCode

      Display a Customer entity and the associated Order and OrderDetail entities.

    • display category categoryId

      Display a product Category entity and the associated Product entities.


Run and building the sample data grid and Java client with Eclipse

The REST data service getting started sample can be updated and enhanced using Eclipse. For details on how to setup the Eclipse environment see the text document: restservice_home/gettingstarted/ECLIPSE_README.txt.

After the WXSRestGettingStarted project is imported into Eclipse and is building successfully, the sample will automatically re-compile and the script files used to start the container server and client will automatically pick up the class files and XML files. The REST data service will also automatically detect any changes since the Web server is configured to read the Eclipse build directories automatically.

When changing source or configuration files, both the eXtreme Scale container server and the REST data service application must be restarted. The eXtreme Scale container server must be started before the REST data service Web application.

Parent topic:

REST data services sample and tutorial

Related concepts

Enable the REST data service

Related tasks

Configure application servers for the REST data service

Use a browser with REST data services

Related reference

Directory conventions

Visual Studio 2008 WCF client with REST data service


Search Tips   |   Advanced Search