Java Reference
In-Depth Information
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 file, an implementation of web services is performed 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 file 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 a 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, going to File | New File , then selecting the Web
Services category, and finally selecting Web Service as our file type.
 
Search WWH ::




Custom Search