Generating a Java client proxy and a sample application
from a WSDL document using the Axis2 runtime environment
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.
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).
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:
Enter the URI to the WSDL, WSIL, or HTML file that will be used
to generate the client.
Select the type of proxy to be generated
Select the stages of Web services development that you want
to complete using the slider:
- Develop: this will develop the WSDL definition and implementation of the
Web service. This includes such tasks as creating the modules which will contain
the generated code and Java files, as well as copying the Axis
- Assemble: this ensures the project that will host the Web service or client
gets associated to an EAR when required by the target application server.
- Deploy: this will create the deployment code for the service.
- Install: this will install and configure the Web module and EARs on the
- Start: this will start the server once the service has been installed
on it. The server-config.wsdd file will be generated.
- Test: this will provide various options for testing the service, such
as using the Web Service Explorer or sample JSPs.
Select your server: the default server is displayed. If you
want to deploy your client to a different server click the link to specify
a different server.
Select your runtime: ensure the Apache Axis2 runtime is selected.
Select the client project: the project containing the project
selected in your workspace is displayed. To select a different project and
EAR click on the project link. 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.
Monitor the Web service: this will send the Web service traffic
through the TCP/IP Monitor, which allows you to watch the SOAP traffic generated
by the Web service and to test this traffic for WS-I compliance. Alternately
you can manually set up a TCP/IP monitor as described in
Using the TCP/IP Monitor to test Web services
Axis2 Client Web service configuration
page: Use this page to select the following options:
Service Name: accept the default.
Port Name: accept the default.
Databinding Name: only the Axis2 Databinding Framework (ADB)
is supported at this time.
Custom package name: You can change the package name in this
Client mode: You can choose if the client is synchronous, asynchronous,
Generate test case to test the service: If you select this,
the Axis2 emitter will generate JUnit testcases matching the WSDL provided
to the client. These JUnit testcases will be generated to a newly added source
directory to the client project called test.
Generate all types for all elements referred by schemas
Namespace to package mapping: Use this table to review or edit
the mappings between packages and namespaces.
Web Service Client Test page: Use this page to select the following
Select your test facility. You can test the generated proxy
in the Web Service Explorer, or the Universal Test Client.
Select Run test on server to start the
server for you automatically.
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: https://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 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