The Web Service Client wizard assists you in generating a Java™ bean
proxy and a sample application. The sample Web application demonstrates how
to code a proxy file.
Prerequisites:
- If you are using the Apache Jakarta Tomcat servlet
container as your server, you must install it, configure an instance of it,
and create a Web project targeted to it as described in Creating an Apache Tomcat server and Web project
- Discover and import a WSDL document into the Web project. You can only
use a WSDL file that contains a service element.
To generate a Java client proxy and a sample application
from a discovered WSDL document:
- Switch to the J2EE perspective (Window > Open Perspective
> J2EE).
- In the Navigator view, select the Web project in which you want
to generate a sample application.
- Click File > New > Other. Select Web
Services in order to display the various Web service wizards.
Select the Web Service Client wizard. Click Next.
- Web Services page: Select the type of proxy to be generated, and
whether or not it will be tested.
- Client Environment Configuration page: Select the run-time environment
and the server for your Web service client.
- Click Explore Options and select the
Apache Axis run-time environment and select the server on which you want to
run your Web service client.
- Select the type and name of project in which you want the Web
service client created.
- If you enter the name of an existing project, the project type field
must match that of the existing project. Ensure that the project selected
as the Client Web Project is different from the Service Web Project, or the
service will be overwritten by the client's generated artifacts.
- If you enter a name of a project that does not already exist, the wizard
will create the project for you.
- Note that the only project type supported for Axis and SOAP run-time clients
is a Web project. If you want the client to be created in a Java, EJB,
or Application Client project, you must select the WebSphere® run-time environment for
your client.
- Web Service Selection page: Enter the URI to the WSDL, WSIL, or
HTML file that will be used to generate the client. You can optionally generate
a WSIL file from this file as well.
- Web Service Proxy page: This panel shows the options for the proxy.
It lists the folder where the proxy will be generated, and you can optionally
create custom mappings between namespaces and packages.
- Web Service Namespace to Package Mappings page: if you selected
Define custom mapping for namespace to package on
the previous page, you can enter your custom mapping pairs on this page by
clicking Add.
- Web Service Client Test page: Select the test facility that you
will use to test the proxy, and the methods that you want included in the
proxy. Note that the Universal Test Client (UTC) is only compatible with Web
service clients deployed on WebSphere servers.
- Click Finish. If you have selected to test
the proxy, the test client will open in a browser window.
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 or the Universal test client.
- If you have selected to test the generated proxy using Web service JSPs,
the proxy is launched in a Web browser at the following URL: 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.
- If you have selected to test the generated proxy using the Universal Test
Client, it will be launched in a browser window at the following URL: http://localhost:9080/UTC/preload?object= BeanPackage. BeanServiceProxy. In the Reference pane,
under Object References, 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.
For more information on creating a Web project, refer to the Web application
development documentation.
Note:
- You may encounter the following error when running the Web Service client wizard:
IWAB0399E Error in generating Java from WSDL java.io.IOException: WSDL2Java
emitter timed out (this often means the WSDL at the specified URL is
inaccessible)!
You might be accessing a WSDL file that requires a timeout setting of more than
the default 45 seconds (for example, trying to access a large WSDL file or a
WSDL file on a slow machine). You could change the timeout value for the Axis
WSDL to Java emitter by starting the Eclipse workbench with the
AxisWsdl2JavaTimeout virtual machine argument. The timeout value is
specified in milliseconds. Use a timeout value of -1 if you want the emitter to never
time out.
For example, to set the timeout to 60 seconds, use the following command to
start the Eclipse workbench:
eclipse -vmargs "-DAxisWsdl2JavaTimeout=60000"