JBoss.orgCommunity Documentation
JBoss Tools provides a view to test web services. The Web Services Test View can be displayed by following the steps in Web Services Test View.
Procedure 7.1. Web Services Test View
Access the Show View dialog
Select
→ →The Show View dialog displays.
Click on the Web Services Tester label by expanding the JBoss Tools Web Services node and click .
The Web Services test view displays.
You can also access this view by right-clicking on a WSDL file of a project in the Project Explorer and selecting → from the context menu. This will open the Web Service Tester with the details of the selected WSDL file.
The main components of the Web Service Tester View are:
WSDL path/button bar (Table 7.1, “WSDL path/button bar”)
Request details panel (Table 7.2, “Request details panel”)
Response details panel (Table 7.3, “Response details panel”)
Table 7.1. WSDL path/button bar
Component | Description |
---|---|
Editable dropdown list | Enter the location of the WSDL file or HTTP address of the service to be tested. The combo box requires the path to the WSDL in a URI format. |
Combo box | Select the type of service to test. The options are JAX-WS or any other option to test a JAX-RS service using HTTP request methods (PUT , GET , POST , DELETE or OPTIONS ). |
Toolbar button - Get From WSDL | Click this button to display the Select WSDL dialog. Enter the , location or Eclipse location of the WSDL file. Given a valid file, the dialog will allow selection of the Port and Operation to test. Once selected, the request details will be displayed in the Request Details panel. |
Toolbar button - Invoke | Once the WSDL file has been selected, the service can be invoked by clicking this button. Response details will be displayed in the Response Details panel. |
Table 7.2. Request details panel
Component | Description |
---|---|
Prompt for Basic Authentication | Select this check box to send a username and password with the request. Entering the user details for each subsequent request is not necessary as the details are stored in memory. |
Headers | Enter (name =value pairs. These headers will be passed with the invocation request at the HTTP level where possible. | ) one or more
Parameters | As for header information, enter one or more name =value pairs by clicking the button. |
Body | Enter the JAX-WS SOAP request messages or input for JAX-RS service invocations in this text box. |
Table 7.3. Response details panel
Component | Description |
---|---|
Response headers | The headers returned by the service invocation will be displayed in this panel. |
Response body | The JAX-WS and JAX-RS response bodies will be displayed in this box. The raw text returned from the web service invocation can be displayed by clicking the | button. The output will be embedded in a html browser by clicking the button. The output can alternatively be displayed in the Eclipse editor as xml or raw text (depending on the response content type) by clicking the button.
Parameters | As for header information, enter one or more name =value pairs by clicking the button. |
Body | Enter JAX-WS SOAP request messages and input for JAX-RS service invocations in this text box. |
The following sections describe testing JAX-WS web services.
The following procedure describes the steps to perform before testing a web service.
Procedure 7.2. Testing a web service
Preliminary steps
Prior to testing a web service:
The Web Service Test View should be opened as described in Web Services Test View;
The Web Service Test View displays.
A web service has been deployed to the deploy
directory of the chosen server profile.
The server has been started with run.sh -c <profile>
A JAX-WS web service can be tested by using the Web Service Tester View displayed in Figure 7.1, “Web Service Test View”. The JAX-WS test is specified by:
Step 2 can be performed in a number of ways including:
entering the location directly in the editable dropdown list; or
clicking the
button and entering the , or details.Testing a JAX-WS web service demonstrates testing the WebServiceSample project developed in Generate a sample web service.
Procedure 7.3. Testing a JAX-WS web service
Following the preliminary steps described in Testing a web service, select JAX-WS from the available combo box options.
The SOAP message details are displayed in the Request Body textbox of the Request Details panel.
Enter the location of the WSDL file in the editable dropdown list. The location for the WebServiceSample web service is http://localhost:8080/WebServiceSample/HelloWorld?WSDL
Click the
button.The Select WDSL dialog appears.
Select the required service attributes
Select the Service, and from the comboboxes and click .
The <soap:Body/> section of the SOAP message is filled with the SayHello message details.
The response header details are returned.
The response message body is displayed in the Response Body textbox.
These results indicate a successful test.