Testing web services with sample JSPs
After you create a web service, you can generate sample JSPs that can be run on the server to test the web service.
About this task
Procedure
- Select your Java™ proxy
bean in the Enterprise Explorer, right-click, and select Web services.
- If you are testing a JAX-WS web service select Generate JAX-WS JSPs.
- On the Web Service Client Test page,
you have the following options:
- Test the generated proxy: If selected, the sample client is launched in a web browser so you can see whether the proxy works.
- Select your test facility. Currently the only available option is to generate web service sample JSPs.
- Folder: Select the preexisting folder where the JSP is located.
- Server: Select the server that you want to use.
- Server instance: Select an existing instance of this server. If one does not exist, the wizard creates it for you.
- Methods: Select the methods to expose in the JSP.
- Run test on server: Select this option to start the server automatically.
- The proxy is launched in a web browser at the following URL: http://localhost:port/WebProjectClient/sampleBeanName/TestClient.jsp. If you changed the folder location in the previous step the value of sampleBeanName reflects the new location.
- You can use this sample application to test the web service
by selecting a method, entering a value for the method, and clicking
Invoke. The result of the method displays
in the Results pane.
- Setting endpoints: If you do not know the port that WebSphere® Application Server
uses, it can be found in the administrative console at Servers > Application servers > server_name > Configuration tab > Ports > WC_defaulthost.
- JAX-WS JSPs: To change the endpoint, edit the endpoint that is listed in the Endpoint field of the Quality of Service pane of the JSP, and click Update.
- Asynchrony: If you are using JAX-WS JSPs and you selected to generate asynchronous methods for your proxy, you can enable asynchronous invocation in the TestClient.jsp file using the polling style. If you select to test the service asynchronously, when you invoke the business method, a new link displays, indicating that the method is in progress. Click the link to display the method response in the Results pane.
- Bypassing JAXB mappings: Unlike JAX-RPC 1.1, JAX-WS does not support the generation of Service Endpoint Interfaces with business methods using SOAPElements. Selecting Bypass JAXB and use XML payloads replaces the JAXB bindings view of the TestClient.jsp methods with the raw SOAP message. If you want use this function, enter the required SOAP body entries for into the provided template.
- Setting endpoints: If you do not know the port that WebSphere® Application Server
uses, it can be found in the administrative console at Servers > Application servers > server_name > Configuration tab > Ports > WC_defaulthost.
Parent topic: Testing and validating web services
Related concepts:

