Unknown macro: {next_previous_links}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

This sample demonstrates a basic REST-based Web Services using JAX-RS (JSR-311). The REST server provides the following services:     

  • A RESTful customer service is provided on URL http://localhost:9763/jaxrs_basic/services/customers/customerservice (say serviceURL). Users access this URI to operate on customer.  
  • A HTTP GET request to URL ${serviceURL}/customers/123 returns a customer instance whose id is 123. The XML document returns the following:

    <Customer>
       <id>123</id>
       <name>John</name>
    </Customer>
  • A HTTP GET request to URL ${serviceURL}/orders/223/products/323 returns product 323 that belongs to order 223. The XML document returns the following:

    <Product>
       <description>product 323</description>
       <id>323</id>
    </Product>
  • A HTTP POST request to URL ${serviceURL}/customers with the following data adds a customer whose name is Jack.

    <Customer>
       <name>Jack</name>
    </Customer>
  • A HTTP PUT request to URL ${serviceURL}/customers with following data updates the customer instance whose id is 123.

    <Customer>
       <id>123</id>
       <name>John</name>
    </Customer>

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.

Building and running the sample

This sample can be found at  <AS_HOME>\samples\Jaxws-Jaxrs\jaxrs_basic

For information on building and running the sample, see Building and Running JAX-RS Samples.

  • No labels