If you learn the techniques and concepts for a simple
web service, it's straightforward to extend that knowledge for complex web services.
Chapter 6
[ 131 ]
The first stage in creating our simple web service is to create a Java Web Project that
can act as the service endpoint. From within NetBeans, select the File | New Project
menu option and create a new Web Application by selecting the Next button.
WSDL Editor
[ 132 ]
Enter the name of the project as HelloWorldWS. Ensure that either the Sun Java
System Application Server or GlassFish V2 (depending upon your version of
NetBeans) is selected as the server and that Java EE version 5 is selected. At this
point, press the Finish button to create the project.
Now that we have a web project to host our web service endpoint, we need to define
the WSDL contract. For our simple HelloWorld web service, we are going to define
one port Type (method) called sayHello. This will be a request/response web service
with the request message being a single string and the response method also being
a single string. We're not going to worry about what the Java code looks like yet for
this service as we are defining the contract only first.
Within the Projects window, right-click on the Web Pages node for the
HelloWorldWS project and select the New | WSDL Document.
Pages:
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129