Having generated the web service artifacts, packaged and deployed the web service, generated the runtime JAR file for the web service client, and compiled the client class, next we shall test the web service client. We shall run the build.xml
targets in the following order:
Right-click on the server
target and select Run Target:
The output from the server
target indicates that the clean, setup, build-server-wsdl, create-war
, and deploy
targets are run to deploy the clientjar.war
file to the GlassFish Server:
clean: Deleting directory C:UsersdvohraDocumentsNetBeansProjectsHelloWSuild setup: Created dir: C:UsersdvohraDocumentsNetBeansProjectsHelloWSuild Created dir: C:UsersdvohraDocumentsNetBeansProjectsHelloWSuildclasses Created dir: C:UsersdvohraDocumentsNetBeansProjectsHelloWSuildwar build-server-wsdl: parsing WSDL... Generating code... Compiling code... Compiling 1 source file to C:UsersdvohraDocumentsNetBeansProjectsHelloWSuildclasses create-war: Building war: C:UsersdvohraDocumentsNetBeansProjectsHelloWSuildwarclientjar.war deploy: Copying 1 file to C:glassfish3glassfishdomainsdomain1autodeploy BUILD SUCCESSFUL (total time: 21 seconds)
The clientjar
WAR file is deployed on the Oracle GlassFish Server, as shown in the following screenshot:
Next, run the client target to generate the runtime JAR file and compile the client class. Right-click on the client
target and select Run Target:
The generate-client
and client
targets start running and the runtime JAR file HelloWSServiceClient.jar
is generated:
generate-client: Consider using <depends>/<produces> so that wsimport won't do unnecessary compilation parsing WSDL... Downloading the WSDL and associated metadata Generating code... Compiling code... Archiving the generated artifacts in to C:UsersdvohraDocumentsNetBeansProjectsHelloWSuildclassesHelloWSServiceClient.jar. client: Compiling 1 source file to C:UsersdvohraDocumentsNetBeansProjectsHelloWSuildclasses BUILD SUCCESSFUL (total time: 9 seconds)
The build classes generated by the build-server-wsdl
and client
Ant tasks, and the client JAR generated by the generate-client
task are shown in the following screenshot:
Next, test the client class by running the run
target. Right-click on the run
target and select Run Target:
The client class runs and the web service gets invoked to generate a Hello message as shown in the following screenshot:
The output from the run
target is as follows:
run: Hello John Smith. Welcome to Web Services! BUILD SUCCESSFUL (total time: 10 seconds)