When using the SOAP protocol, web service operations are defined in an XML
document called a Web Services Definition Language ( WSDL ) file. After creating
the WSDL, implementation of web services is done in a proper programming
language such as Java. The process of creating a WSDL is complex and error
prone, fortunately, when working with Java EE, a WSDL can be automatically
generated from a web service written in Java when this web service is deployed to
the application server. Additionally, if we have a WSDL file available, and need to
implement the web service operations in Java, NetBeans can automatically generate
most of the Java code for the implementation, creating a class with method stubs for
each web service operation. All we need to do is to implement the actual logic for
each method, all the "plumbing" code is automatically generated.
Creating a simple web service
In this section, we will develop a web service that performs conversion of units of
length. Our web service will have an operation that will convert inches to centimeters,
and another operation to do the opposite conversion (centimeters to inches).
In order to create a web service, we need to create a new web application project, in
our example, the project name is UnitConversion . We can create the web service by
right-clicking on our project and selecting File | New File , then selecting the Web
Services category and Web Service as our file type.