Screencast #29: Web service using NetBeans 6.8 and GlassFish v3 (Accessing database in business method)

GlassFish v3 comes bundled with Metro - a secure, reliable, transactional, and .NET interoperable Web services stack. Metro is compliant with JAX-WS and provides additional quality of service attributes that can be easily enabled using NetBeans IDE.

This blog contains a screencast that shows how to create a simple Web service using NetBeans 6.8, implement the business logic by accessing a database table using Java Persistence API, and deploy on GlassFish v3.

Please post your questions to

Several other screencasts on GlassFish v3and related topics are available here.

Technorati: netbeans jax-ws metro webservice glassfish jpa database


Hi Arun,

I am new to WebServices and GlassFish - I have followed your screen cast 29 - And I am able to complie and deploy - But i think i m missing something - I dont see the Test page as shown in your screen cast- Instead I just see the link to wsdl. Hence I am not able to test my methods. Please advice.

A quick response would be really appreciated.

Posted by Harsh on February 22, 2010 at 01:24 AM PST #


The WSDL is accessible at "?wsdl" and tester page is at "?tester". Can you try that ?

Posted by Arun Gupta on February 23, 2010 at 08:43 AM PST #

Hello Arun,

Thanks for your demo on creation of web service using netbeans. Very useful!!

Posted by Geethapriya on March 03, 2010 at 09:25 PM PST #

Hello Arun,

How to call a web service created using netbeans in one platform say windows from an application[a jsp file] running in another platform say linux[run virtually over windows]

Posted by Geethapriya on March 04, 2010 at 07:59 PM PST #


You'll need to generate the client side artifacts by importing WSDL of the Web service hosted on Linux, bundle the classes with your application on Windows and then use them in your JSP/Servlet.

A slightly old screencast at:

shows how to invoke a Web service.

Posted by Arun Gupta on March 05, 2010 at 02:42 AM PST #

Sorry to post here because i don't find your email in the blog.
I would like to thank you for this amazing blog.

I started with web services and I work with Netbeans and Glassfish.
I managed to make a web service which is for example the sum of two integers deploy on the same machine.

Now I want to make sure that my web service is deployed on several machines in a LAN

and the client (stub) web service chooses a machine to send the SOAP request and receive response

Eg if the client wants to do two sums at the same time, it sends two SOAP request containing the arguments of the sum for each machine and receives the response from both machines

Excuse me my bad English because I'm French
Thank you in advance

Posted by Marouene on March 16, 2010 at 08:08 PM PDT #

Hi Arun,
I have been following you blog for a long time and it has helped me on various occasions.

Web Services is my current focus mostly JAX-WS on glassfish, however i have used AXIS2 as well.

My Question to you is how would you consume a web service if it is behind a SSO, in this case AXIS2 WS is part of a web application and behind a SSO.

For normal web application the SSO layer will use the configured security layer and let the user pass through, how will a java SE client access the same WS?

Any help would be welcome,
Thanks in advance


Posted by Avinash Yadav on June 09, 2010 at 10:59 PM PDT #


Please ask your Axis related question on Apache forums :-)

Posted by Arun Gupta on June 10, 2010 at 01:46 AM PDT #

Hi Arun. I really learn a lot from your blog. Now have a problem and could not find any info from web search and you may help me.

I have a Java EE application (myApp, myApp-ejb and myApp-war) and it could be built and deployed properly.

I also create the java-ws example CalculatorWSService (Getting Started with JAX-WS Web Services, in a web app. it also work find.

Now I create a web service in myApp (myApp-war) adding the same code as the CalculatorWSService. After build and deploy, when test the ws, it only came null:
Exceptions details : null
java.lang.NullPointerException at at org.glassfish.webservices.monitoring.WebServiceTesterServlet.initializePort( at org.glassfish.webservices.monitoring.WebServiceTesterServlet.doGet( at org.glassfish.webservices.monitoring.WebServiceTesterServlet.invoke( at org.glassfish.webservices.JAXWSServlet.doGet( at javax.servlet.http.HttpServlet.service( at javax.servlet.http.HttpServlet.service( at org.apache.catalina.core.StandardWrapper.service( at org.apache.catalina.core.StandardWrapperValve.invoke( at org.apache.catalina.core.StandardContextValve.invoke( at org.apache.catalina.core.StandardPipeline.invoke( at com.sun.enterprise.web.WebPipeline.invoke( at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke( at org.apache.catalina.core.StandardHostValve.invoke( at org.apache.catalina.connector.CoyoteAdapter.doService( at org.apache.catalina.connector.CoyoteAdapter.service( at at com.sun.grizzly.http.ProcessorTask.invokeAdapter( at com.sun.grizzly.http.ProcessorTask.doProcess( at com.sun.grizzly.http.ProcessorTask.process( at com.sun.grizzly.http.DefaultProtocolFilter.execute( at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter( at com.sun.grizzly.DefaultProtocolChain.execute( at com.sun.grizzly.DefaultProtocolChain.execute( at com.sun.grizzly.http.HttpProtocolChain.execute( at com.sun.grizzly.ProtocolChainContextTask.doCall( at at at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork( at com.sun.grizzly.util.AbstractThreadPool$ at


What is the problem? How to solve this?

Posted by kingsz1 on July 05, 2010 at 10:08 AM PDT #

Hi arun,

I am new to netbeans webservices. I have created a rest ful webservice in netbeans for accessing the data base. but i am not able to create a restful client for that webservice.
pls help me....... i am using netbeans ide 6.9.1


Posted by prabhu on September 23, 2010 at 08:52 PM PDT #

Post a Comment:
Comments are closed for this entry.

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.

Java EE 7 Samples

Stay Connected


« January 2017