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.
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
- Create or import a bean into the Java™ source folder of the Web project.
To create a Web service from a bean using the Apache Axis run-time
environment:
- Switch to the J2EE perspective ( Window > Open Perspective
> J2EE).
- 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. You can optionally choose to do the following:
- Start the Web service in a Web project - if you do not select this option
you will have to manually start the Web service. You must select this option
to enable the other options on this page.
- Launch the Web Services Explorer to publish your Web service to a UDDI
registry.
- Generate a Java bean client proxy to the Web service. The Java bean
client proxy that is generated provides a remote procedure call interface
to the Web service.
- Test the Web service - this allows you to test the Web service in the
Web Service Explorer before a proxy is generated.
- 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. Note that this is only supported for Tomcat v4.0
and v4.1. If you are using Tomcat v5.0 and want to monitor the Web service
traffic, you need to manually set up a TCP/IP monitor as described in Using
the TCP/IP Monitor to test Web services
- Object selection page: select the Java bean from which the Web service will
be created.
- Service Deployment Configuration page: specify the server and client
deployment settings.
- Click Edit and select the Apache Axis
run-time environment and select the server on which you want to run your Web
service and Web service client.
- Select the Web project in which you want your Web service created,
and the EAR with which it will be associated. The wizard will
create these for you if they do not already exist.
- 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. 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.
- Select an existing EAR or enter a unique name to associate the
Web service client with a different EAR than the Web service EAR. Note: Selecting
different EARs for the Web service and Web service client can reduce the chance
of encountering run time errors, but will use more system resources.
- A message will display stating that you have made a WS-I non-compliant
selection. The Apache Axis run-time environment is not WS-I compliant.
Select Ignore.
- Web Service Java Bean Identity page: the Web service
URI and WSDL name will be listed. You have the following
options:
- Select the methods to expose.
- Select the encoding style. RPC/Encoded is the recommended encoding style
for the Axis run-time environment. This encoding method is not WS-I compliant.
- Select if you want to customize the package to namespace mappings.
Click Next
- Web Service Package to Namespace Mappings page: if you selected
Define custom mapping for package to namespace on
the previous panel, you can enter your custom mapping pairs on this panel
by clicking Add.
- 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.
- Web Service Proxy page: if you have selected to generate a proxy,
select if you want to customize the package to namespace mappings.
- Web Service Client Test page: Use this page to select the following
options:
- Select your test facility. You can test the generated proxy
in the Universal Test Client or the Web Service Explorer, or you can generate
a sample Web service JSP.
- If you selected to test the proxy through a JSP, you can select
the folder where the JSP will be located, and you can select the methods that
will be included in the JSP.
- 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. Note: you may see a warning stating Error in generating WSDL
from Java. ClassNotFound: <bean name>. This error can be safely
ignored.
After the Web service has been created, the following may occur
depending on the options you selected:
- 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.
- If you have selected to publish the Web service, the Web Services Explorer
is launched displaying the page required to publish your Web service to the IBM® UDDI
Test Registry. Follow the instructions in Publishing the Web service to
complete this task.
Note:
- 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
message.
- You may encounter the following error when running the Web Service 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"
Once you have created your Web service from a bean, you may
test the methods of your Web service, using the Universal Test Client, and
then publish your Web service to a UDDI Business Registry. For more information
on publishing your Web service using the Web Services Explorer, refer to Publishing
a Web service. For more information on the Universal Test Client, refer
to the Server tools online help.