RESTfulWebServicesSamples

RESTful Web Services Samples for NetBeans 6.0

This page lists the RESTful Web services samples for NetBeans 6.0. Sample are in Beta 1.


Customer App

This is a RESTful Web Service Sample which demo the Web 2.0 Client stub in action interacting with REST Web Service Resources. It is based on Client Stub generation from RESTful Web Service Resources

Screenshots:

The following 4 snapshots show the CustomerDB Client (100% Javascript) demonstrating the CRUD (Create, Retrieve, Update and Delete) functionality of RESTful Web Services.


1. Retrieve all customers

This page displays all the customers id, name, email information. It also lets user delete individual customer by clicking 'Delete' button next to each customer row. Click on the link on the Id column to show the customer details including the discount code. Click 'Add' to create a new customer.


Image:CustomerDBClient_RESTfulWebServicesSamples.png


2. Retrieve customer '1'

After clicking the link on the Id column for customer with Id '1'. Click 'Edit' button to start editing.


Image:CustomerDBClient_C1_RESTfulWebServicesSamples.png

3. Edit customer '1'

This page lets user edit the customer '1' details. After modifying the contents, click 'Update' button to update the changes to the server.


Image:CustomerDBClient_C1_Edit_RESTfulWebServicesSamples.png

4. Create new customer

This page shows the Create new customer functionality. This is obtained by click 'Add' on the 'View Customers' page (the home page)


Image:CustomerDBClient_C1_New_RESTfulWebServicesSamples.png


Note:

  • Delete on existing customers would fail, due to database existing constraint on the CustomerDB 'Customer' table, so try deleting a new customer that you created.
  • Create new customer selects a new Id starting from <1000 + max(no of customers in the DB)>.

Preparation:

0. Required Installations:

Note:

(For Eg:- http://bits.netbeans.org/download/6.0/nightly/200708280000/)

  • I found an issue (error with using TopLink JPA Provider) with GF glassfish-v2-b58c build, so try glassfish-v2-b58. Glassfish-v2-b58 can be obtained from GF site.

(See GF issue 3557 for details)

1. Create a 'CustomerDB' RESTful Web Service Application:

  • Click on 'New Project' button to bring up the wizard, select 'RESTful Web Services' under 'Samples' category and 'Customer Database' project type. Click 'Next'.
  • Select everything default on this 2nd page. Then click 'Finish' to create the 'CustomerDB' Web Application.

Facts:

  • Java DB (Derby) integration is included as part of NetBeans bundle. JDBC driver for Java DB, is included by both NetBeans 6.0 and AppServer.

2. Test 'CustomerDB' RESTful Web Services:

  • Right click on the project node 'CustomerDB' and select 'Test RESTful Web Services'. The web application will be built, deployed and the default browser will be brought up with the test client page. Select 'customers' link on the tree view of resources (on the left side of the page). Then click 'Test' button to test CRUD (Create, Retrieve, Update, Delete) functionality on resource '/customers/'.

3. Create a 'CustomerDBClient' RESTful Web Service Client Application:

  • Click on 'New Project' button to bring up the wizard, select 'RESTful Web Services' under 'Samples' category and 'Customer Database Client' project type. Click 'Next'.
  • Select everything default on this 2nd page. Then click 'Finish' to create the 'CustomerDBClient' Web Application.
  • Right click on the 'CustomerDBClient' project and select 'Run'. You should see a page "http://localhost:8080/CustomerDBClient". In this page you should see all customers information in a table.

You could now try all the CRUD functionality of RESTful Web Services on this Client application in a easy way.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo