

The request element specifies how to represent the input, what types are required and any specific HTTP headers that are required. Each resource has param elements to describe the inputs, and method elements which describe the request and response of a resource. According to Wikipedia, in the WADL file, ‘the service is described using a set of resource elements. The WADL provides all the information you need to understand to the various RESTful web service’s resources, and how to call them using their URIs. The WADL file is to RESTful web services, as the WSDL (Web Service Definition Language) file is to non-RESTful, SOA-/SOAP-oriented web services. Note the link in the upper right corner of the above screens, labeled WADL: ‘ The WADL (Web Application Description Language) file is the machine-readable XML description of the RESTful web service(s). Confirming these items will elevate many problems you might otherwise encounter when creating the data source, next.Ĭount of All Employees Being Successfully Retrieved from the Adventure Works Database WADL Lastly, confirm the ‘aw_dev’ user can connect to the Adventure Works database and view and interact with all the database objects. Confirm the Adventure Works database is installed in that instance. Using Microsoft’s SQL Server Management Studio, Quest’s Toad for SQL, or similar IDE, confirm the ‘Development’ instance (or whatever you have named your instance) of SQL Server 2008 R2 is running. Build and deploy the project to GlassFish.Test the web services locally in NetBeans.Create RESTful web services using the entity classes.Create entity classes from the SQL Server database.Create the SQL Server data source in the project.Create a new Web Application project in NetBeans.

Confirm the SQL Server instance, database, and user are functioning properly.Here are the high-level steps I will walk-through in this post:

Note, since I have NetBeans, SQL Server, and GlassFish all installed on a single computer, the URLs in several of the screen-grabs switch between ‘localhost’ and my computer’s actual name. This is necessary before following along with this demonstration.
NETBEAN GLASSFISH DRIVER
Also, refer to my earlier post, Connecting Java EE to SQL Server with Microsoft’s JDBC Driver 4.0, for directions on installing the Microsoft JDBC driver in the lib directory of GlassFish. The post takes you through creating a SQL Server 2008 R2 instance (entitled ‘Development’), installing the Adventure Works database, and creating a database user (‘aw-dev’). If you have any questions about installing and configuring the Adventure Works database, please refer to my post, Convert VS 2010 Database Project to SSDT and Automate Publishing with Jenkins – Part 1/3. GlassFish 3.2.2.2 Open Source Edition Application Server (installed with NetBeans or downloaded separately from ).Apache Any 1.82 (installed with NetBeans or downloaded separately from ).Microsoft JDBC Driver 4.0 for SQL Server ( /en-us/sqlserver/aa937724.aspx).Microsoft’s Adventure Works 2008 R2 Sample Database ( ).To demonstrate the example in this post, I have the follow applications installed, configured, and running in my development environment: Test the RESTful Web Services locally in NetBeans, and once deployed, in GlassFish.Compile and deploy the data source, entities, and services to GlassFish.Create RESTful web services using JAX-RS, which communicate with database, through the entity classes.Create entity classes from the SQL Server database using the SQL Server Data Source.Demonstrate the use of Microsoft’s JDBC Driver 4.0 to connect a Java-based application to SQL Server 2008 R2.In this post, I am going to offer a high-level, end-to-end overview on how to create and connect Java EE RESTful web services, hosted on GlassFish, to SQL Server. In a more recent post, Calling Microsoft SQL Server Stored Procedures from a Java Application Using JDBC, I demonstrated the use of JDBC to call stored procedures from a Java application. In a previous post, Connecting Java EE to SQL Server with Microsoft’s JDBC Driver 4.0, I demonstrated how Microsoft’s JDBC Driver 4.0 can connect Java-based RESTful web services to Microsoft SQL Server. Show how to test and deploy the project to GlassFish. Demonstrate the creation of a Web Application project in NetBeans, including a SQL Server data source, entity classes from a SQL database, and RESTful web services. Connecting Java EE RESTful web services, hosted on GlassFish, to Microsoft SQL Server – a high level overview.
