Testing web services with sample JSPs

After you have created a web service you can generate sample JSPs which can be run on the server to test the web service.

About this task

To generate a sample JSP to test a web service:

Procedure

  1. Select your Java™ proxy bean in the Enterprise Explorer, right-click and select Web services.
    • If you are testing a JAX-RPC web service select Generate JAX-RPC JSPs.
    • If you are testing a JAX-WS web service select Generate JAX-WS JSPs.
  2. On the Web Service Client Test page you have the following options:
    • Test the generated proxy: If selected, the sample client will be launched in a Web browser enabling you to test the functionality.
    • Select your test facility. Currently the only available option is to generate web service sample JSPs.
    • Folder: You can select the preexisting folder where the JSP will be located.
    • Server: Select the server you want to use.
    • Server instance: Select an existing instance of this server. If one does not exist, the wizard will create it for you.
    • Methods: Select the methods to expose in the JSP.
    • Run test on server: this will start the server for you automatically.
  3. The proxy is launched in a Web browser at the following URL: http://localhost:port/WebProjectClient/sampleBeanName/TestClient.jsp . Note that if you changed the folder location in the previous step the value of sampleBeanName will reflect the new location.
  4. 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 will display in the results pane.
    • Setting endpoints: If you do not know the port WebSphere® Application Server is using, it can be found in the WebSphere administrative console (Servers > Application servers > server_name > Configuration tab > Ports > WC_defaulthost)
      • JAX-RPC JSPs: methods for getting and setting the endpoint are listed in the Methods pane. If you need to change the endpoint such as when running web service traffic through the TCP/IP Monitor, invoke the getEndpoint method, copy the result and then paste the result and update the endpoint where necessary before invoking the setEndpoint method.
      • JAX-WS JSPs: to change the endpoint edit the endpoint 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 have selected to generate asynchronous methods for your proxy, you will have the option of enabling asynchronous invocation in the TestClient.jsp using the polling style. If you select to test the service asynchronously, when you invoke the business method a new link will display 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 will replace the JAXB bindings view of the TestClient.jsp methods with the raw SOAP message. If you want use this function a template of the envelope is provided and you need to manually enter the required SOAP body entries for input.

Feedback