In this section, we will create a JSP Web Service client for the HelloWorld
web service. To create a JSP, select File | New | Other. In New, select Web | JSP File and click on Next, as shown in the following screenshot:
In the New JSP File wizard, select the webapp
folder, specify File name as JAXWSClient.jsp
, and click on Next, as shown in the following screenshot:
Select the New JSP file (html) template and click on Finish. The JAXWSClient.jsp
file gets added to the webapp
folder. In the client JSP, we will invoke the web service with a name and display the web service response in the browser. First, create a URL object for the WSDL. The URL for a web service is constructed from the context root + endpoint:
URL wsdlLocation = new URL("http://localhost:8080/jboss-jaxws/HelloWorld?WSDL");
The jboss-jaxws
in the URL is the context root and the /HelloWorld
is the servlet mapping URL for the web service endpoint as specified in the web.xml
. Next, create a QName
object...