||
Skip to end of metadata
Go to start of metadata

Using Maven

Apache Maven 3 is recommended to build the samples.

Follow the steps given below before you build and run the sample:

  1. Open the sample folder in your product pack using a command line and go to the <PRODUCT_HOME>\samples\Jaxws-Jaxrs\<JAX-RS-Sample-Folder> directory. The folders for Jax-rs samples are listed here: JAX-RS Sample Folder.
  2. Build the demo and create a WAR file using the following command.

    mvn clean install
  3. Deploy the generated WAR file in WSO2 AS with the related logs on the console using the following command:

    mvn -Pdeploy

    This command will copy the WAR file to the <AS_HOME>/repository/deployment/server/webapps directory.

  4. Start  the WSO2 Application Server by executing one of the following commands, where <PRODUCT_HOME> is the directory where you installed the product distribution:

    OSCommand
    On Windows
    <PRODUCT_HOME>\bin\wso2server.bat --run
    On Linux/Solaris
    sh <PRODUCT_HOME>/bin/wso2server.sh  
  5. 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.

  6. You can open the required web application by clicking the Find Services action.

If you want to remove the target directory, run the following command inside the <PRODUCT_HOME>\samples\Jaxrs-Jaxrs\<JAX-RS-Sample-Folder> directory:

mvn clean

Using Apache Ant

You need Apache Ant 1.6.2 or higher to build the samples.

  1. Open the sample folder in your product pack using a command line and go to the <PRODUCT_HOME>\samples\Jaxws-Jaxrs\<JAX-RS-Sample-Folder> directory. The folders for Jax-rs samples are listed here: JAX-RS Sample Folder.

  2. To deploy the sample, run the following command:

    ant
  3. Start the Application Server and log in to the management console.
  4. You can run the sample in two ways:
    1. Log in to the management console. On the Main menu, under Manage/Applications, click List to open the Running Applications page. The deployed applications will be listed here. 
    2. Using the command line, go the JAX-RS sample directory and execute the following command:

      OSCommand
      On Windowsrun-client.bat
      On Linux/Solarissh run-client.sh

      The results of the sample will show on the command line.

For different options, run:

sh run-client.sh -help
JAX-RS Sample Folder
SampleJAX-RS Sample Folder
JAX-RS Basicsjaxrs_basic
JAX-RS Advancedjaxrs_starbucks_service
JAX-RS Sample on Content Negotiationjaxrs_content_negotiation
  • No labels