Login
Register

Home

Trainings

Fusion Blog

EBS Blog

Authors

CONTACT US

Fusion Blog
  • Register

Oracle Gold Partners, our very popular training packages, training schedule is listed here
Designed by Five Star Rated Oracle Press Authors & Oracle ACE's.

webinar new

Search Courses

Objective:

In the previous article Conversion of Object to XML document and from XML to Object in Java we have learned about the conversion of both the formats. In this article we will see how to implement and deploy web services in Java.


Implement and deploy web service:

This end to end scenario should test creation of simple web service from scratch with simple logging message handler in web project. The scenario covers developing of simple JAX-WS 2.0 based web service with message handler.
The document is not intended as test specification for this feature but describes developing simple web service in NetBeans 5.5

Table of Contents
Creating web project

Creating web service

Implementing web service

Creating message handler

Testing web service

Web application sources are available here.

Creating web project

Go to File - New Project - Web - Web Application

Specify HelloWs as Project Name

Specify project's directory

Choose Java EE 5 as J2EE version and

Click Finish

Creating web service

Go to File - New File - Web services - Web Service - Next

Specify name of web service, eg. HelloWebService

Specify package for the web service, eg. org.netbeans.end2end.hellosample

Click Finish

Implementing web service

Uncomment commented code in source file

Add serviceName="GreeterWs" to WebService annotation

Add operationName="sayHi" to WebMethod annotation

Add @WebParam(name="name") to String param argument of method operation

Add new sayHello(String): String operation to web service using Web Service -> Add Operation... action in editor

Implement both operation, so the implementation class will look like this:



Creating message handler

Go to File - New File - Web services - Message Handler - Next

Specify name of message handler, eg. MessageHandler

Specify package for the message handler, eg. org.netbeans.end2end.hellosample

Click Finish

Implement simple log method in handler, eg. like on following picture:

 

And add handler to the webservice using Configure Handlers action in context menu on HelloWebService's node



web serviceTesting 

Now we finished our web application with web service and we're ready to build and deploy it and check web service if it works correctly.

Invoke Deploy action from project's context menu

Invoke Test Web Service action from web service's context menu

Let's test web service using the form opened in web browser:





Varun Kapila

Add comment


Security code
Refresh

About the Author

Varun Kapila

Search Trainings

Fully verifiable testimonials

Apps2Fusion - Event List

<<  Apr 2024  >>
 Mon  Tue  Wed  Thu  Fri  Sat  Sun 
  1  2  3  4  5  6  7
  8  91011121314
15161718192021
22232425262728
2930     

Enquire For Training

Fusion Training Packages

Get Email Updates


Powered by Google FeedBurner