On the New Web Service from WSDL wizard dialog, enter the web service name as
sayHello, the package as soabook.ch6 and browse the file system to select the WSDL
file we have just created. This WSDL file is created by default within the \Web folder
of the project.
WSDL Editor
[ 136 ]
Wait a few seconds while NetBeans parses the WSDL file until the Web Services Port
field is populated. At this point, select the Finish button to create the web service.
NetBeans will now analyze the WSDL document and create Java code to represent
the web service we have just defined. We now need to fill in the stub code that
NetBeans has generated with some business logic??”our HelloWorld code. Open
up the Source Packages node in the project explorer and open the file soabook.ch6.
sayHello.java
Within that file, select the Source tab and locate the sayHello() method. Change the
method to:
public java.lang.String sayHello(java.lang.String yourName) {
return "Hello "+yourName;
}
Chapter 6
[ 137 ]
Now that we have created our sample web project, lets take a look at the project
structure and see what files have been created.
NetBeans has created a standard NetBeans Web Project directory structure with the
standard build, nbproject, src, test and web directories. Each of these directories
contains the standard files that NetBeans creates for a web project.
Pages:
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131