Generate a Web service client from a WSDL document using the JAX-WS runtime environment
Overview:
The Web Service Client wizard assists you in generating a Java bean proxy and a sample Web application.
The sample Web application demonstrates how to code a proxy file.
Prerequisites:
- Start the server before running the Web service wizard as it may take several minutes to start the WAS...
Window | Show View | Servers | Server (right-click) | Start- Discover or import a WSDL document into the workspace.
You can only use a WSDL file that contains a service element.
You can use...
- A static WSDL file from your workspace
- A WSDL file residing at a URL
- If you have an annotated bean acting as a JAX-WS Web service in your workspace, the WSDL file dynamically produced by the WAS Feature Pack for Web Services runtime. This WSDL can be found at the URL:
http://localhost:port/proj_name/service_nameService?wsdlFor example in the address book JAX-WS Web service created in the tutorial and samples accompanying the Feature Pack for Web Services the dynamic WSDL file would be found at this URL:
https://localhost:9450/jwsAddressBook/AddressBookService?wsdlTo run a simple Java Web service client outside of any J2EE container, generate the Web service client into a simple Java project. The Web service wizard cannot create a simple Java project.
The closest form is an utility project, however running a simple Java Web service client (containerless) from an utility project is not supported. You must create a simple Java project before running the Web service client wizard.
To generate a Java client proxy and a sample application from a discovered WSDL document:
- Switch to the Java EE perspective
Window | Open Perspective | Java EE
File | New | Other | Web Services | Web Service Client | Next
Develop | Develop the WSDL definition and implementation of the Web service client. This includes such tasks as creating the modules which will contain the generated code, WSDL files, deployment descriptors, and Java files when appropriate. |
Assemble | Ensure the project that will host the Web service client gets associated to an EAR when required by the target application server. |
Deploy | Create the deployment code for the client. |
Install | Install and configure the Web module and EARs on the target server. If any changes to the endpoints of the WSDL file are required they will be made in this stage. |
Start | Start the server once the client has been installed on it. |
Test | Provide various options for testing the service, such as using the Web Service Explorer or sample JSPs. |
The generated Java bean proxy provides a remote procedure call interface to the Web service. The sample Web application demonstrates how to code the proxy file.
Once you have generated your Java client proxy, you may test the methods of the Web service through the proxy using Web Services sample JSPs, the Universal test client, or the Web Services Explorer.
http://localhost:port/WebProjectClient/sampleBeanName/WebServiceName/TestClient.jsp
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.
http://localhost:port/UTC/preload?object=BeanPackage.BeanServiceProxyUnder Objects, expand the proxy stub to display the methods of the Web service. Click the method you want to test, enter a value in the Parameters pane, and click Invoke. The result will be generated below.
- If you have selected to test the Web service using the Web Services Explorer, the Explorer will open. Select the operation you want to test, enter the required information, and click Go. The result will display in the Status pane.
IBM WebSphere JAX-WS runtime environment
Creating a Web service from a Java bean using the IBM WebSphere JAX-WS runtime environment
Creating a Java bean skeleton from a WSDL document using the WebSphere JAX-WS runtime environment
Web services runtime environments
Using the Web Services Explorer