Creating a Web service from a Java bean using the Apache Axis2 runtime
The Web Service wizard assists you in creating a new Web service,
configuring it for deployment, and deploying the Web service to a server.
Once your Web service is deployed, the wizard assists you in generating the
client proxy and sample application to test the Web service. When you have
completed testing, you can publish your Web service to a UDDI Business Registry
using the Export wizard.
You must have installed the Apache Axis2 runtime
environment as described in:
Creating Web services with the Apache Axis2 runtime environments
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
- Create or import a bean into the Java™ source folder of the Web project. To
import, select the Java Resources: src folder, and from
the file menu select and browse to where your
To create a Web service from a bean using the Apache Axis2 runtime
Switch to the Java EE perspective (Window > Open Perspective
> Java EE).
In the Project Explorer view, select the bean that you created
or imported into the source folder of your Web project.
Click File > New > Other. SelectWeb
Services in order to display the various Web service wizards.
Select the Web Service wizard. Click Next.
Web Services page: select Bottom up Java bean Web service as
your Web service type, and select the Java bean from which the service will be
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, WSDL files, deployment descriptors, and Java files
- 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 service to a different server click the link to specify
a different server.
Select your runtime: ensure the Apache Axis2 runtime is selected.
Select the service project: the project selected in your workspace
is displayed. To select a different project click on the project link. If
you are deploying to WebSphere® Application Server you will also be asked
to select the EAR associated with the 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 want to create a client, select the type of proxy to
be generated and repeat the above steps for the client.
Publish the Web service: this will launch the Web Services Explorer
to publish your Web service to a UDDI registry.
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 Web Service Java Bean Configuration page: If you have
a custom services.xml file you can point to it on this page, or you can have
the wizard create a default services.xml file for you.
Web Service Test page: If you selected to test the Web service,
select the test facility for the generated Web service. This will
open the Web service in the Web Services Explorer. Select the operation you
want to test, enter the required information, and clickGo.
The result will display in the Status pane. Click Next.
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.
Web Service Publication page: Select whether or not you want to
publish this Web service to a UDDI registry. Click Finish.
After the Web service has been created,
the following may occur depending on the options you selected:
- 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.
- If you have selected to publish the Web service, the Web Services Explorer
is launched displaying the page required to publish your Web service. Follow
the instructions in Publishing the Web service to complete
Important: If your methods contain types,
not supported by the sample, such as arrays, indexed properties, and collections,
the methods will be omitted from the sample and you will receive a warning