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 users@glassfish.dev.java.net.

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

Technorati: netbeans jax-ws metro webservice glassfish jpa database

Comments:

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.
Thanks,
Harsh

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

Harsh,

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 #

Geethapriya,

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:

http://blogs.sun.com/arungupta/entry/screencast_ws2_invoking_a_web

shows how to invoke a Web service.

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

hello,
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

-Avinash

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

Avinash,

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, http://netbeans.org/kb/docs/websvc/jax-ws.html) 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 java.io.File.(File.java:222) at org.glassfish.webservices.monitoring.WebServiceTesterServlet.initializePort(WebServiceTesterServlet.java:505) at org.glassfish.webservices.monitoring.WebServiceTesterServlet.doGet(WebServiceTesterServlet.java:165) at org.glassfish.webservices.monitoring.WebServiceTesterServlet.invoke(WebServiceTesterServlet.java:100) at org.glassfish.webservices.JAXWSServlet.doGet(JAXWSServlet.java:193) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619)

------------------------

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

thanks

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

Post a Comment:
Comments are closed for this entry.
About

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

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today