This documentation is for WSO2 Enterprise Integrator version 6.0.0 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc
Skip to end of metadata
Go to start of metadata

This sample demonstrates a basic REST-based Web Services using JAX-RS (JSR-311).

Building the sample 

  1. Open a command line, and navigate to the <EI_HOME>/samples/webapps/jaxrs_basic directory.
  2. Run the relevant command to deploy the web app:
    • Using Maven

      1. Create a WAR file for the sample using the following command:

        mvn clean install
      2. Deploy the generated WAR file on WSO2 EI with the related logs on the console:

        mvn -Pdeploy
    • Using Ant

  3. Start WSO2 EI by executing one of the following commands:

    On Windows
    <EI_HOME>\bin\integrator.bat --run
    On Linux/Solaris
    sh <EI_HOME>/bin/  
  4. Log in to the management console and click List on the Main menu, under Manage/Applications. This opens the Running Applications page. The deployed applications will be listed here.

Running the sample

You can invoke the JAX-RS web application as shown below.

  • Get the customer instance for customer ID 123 by sending an HTTP GET request to http://localhost:8280/jaxrs_basic/services/customers/customerservice/customers/123. The XML document returns the following:

  • Get the product 323 that belongs to order 223 by sending an HTTP GET request to http://localhost:8280/jaxrs_basic/services/customers/customerservice/orders/223/products/323. The XML document returns the following:

       <description>product 323</description>
  • Add the customer named Jack by sending an HTTP POST request to http://localhost:8280/jaxrs_basic/services/customers/customerservice/customers as shown below.

  • Update the customer with ID 123 as shown below by sending an HTTP PUT request to http://localhost:8280/jaxrs_basic/services/customers/customerservice/customers.


The client code demonstrates how to send HTTP GET/POST/PUT/DELETE requests; whereas, the server code demonstrates how to build a RESTful endpoint through JAX-RS (JSR-311) APIs.

  • No labels