Prerequisites:
- Create an EJB project and add it to a new EAR project. This project will
hold the generated skeleton EJB bean.
- Create an empty Web project if you are using SOAP over HTTP as your transport
methods, or an EJB project if you are using SOAP over JMS as your transport
method, to act as the router project. The project you create must be added
to the same EAR as the EJB project that will contain the enterprise bean.
- Discover and import a WSDL document into the Web project. You can only
use a WSDL file that contains a service element.
- If you want to use SOAP over JMS, you must create a server and server
configuration for JMS as described in Create
a server and server configuration for SOAP over JMS.
- It is strongly suggested that you start the WebSphere Application Server
before running the Web service wizard since it may take several minutes to
start the depending on the speed of your computer. To start the server, select
it in the Servers view (Window > Show View > Servers),
right-click and click Start.
The Web Service wizard assists you in creating a skeleton EJB
from an existing WSDL document. The skeleton EJB contains a set of methods
that correspond to the operations described in the WSDL document. When the
EJB is created, each method has a trivial implementation that you replace
by editing the bean.
For more information on EJB application development,
refer to EJB tools.
To create a skeleton EJB from a WSDL document:
- Switch to the J2EE perspective (Window > Open Perspective >
J2EE).
- In the Project Explorer view, select the Web project in which you
want to create the skeleton EJB Web service.
- Click File > New > Other. Select Web Services in
order to display the various Web service wizards. Select the Web Service wizard.
Click Next.
- Web Service page: select Skeleton EJB Web service from
the Web service type drop down list. 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.
- Object Selection page: Enter the URI to the WSDL, WSIL, or HTML
file that will be used to generate the EJB bean. You can optionally generate
a WSIL file from this file as well. Ensure that there are no spaces
at the beginning of the URI or you may generate a null pointer exception.
- Service Deployment Configuration page: specify the server and client
deployment settings.
- Click Edit and select the IBM® WebSphere® run-time
environment and select the server on which you want to run your Web service
and Web service client. The WebSphere run-time environment is the only
supported run-time environment for this type of Web service.
- Select the service project and EAR for your Web service. 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.
- Web Service Skeleton EJB Configuration page: This page displays
the name of the WSDL file being generated. Select the Router project (which
must be a pre-existing EJB project) and the security settings for the server
side of the Web service. If there is already an SEI in your workspace, you
can select to use it, or the wizard can generate one for you. If you are using
SOAP over JMS as your transport method, most of the information in the JMS
URI properties should be prefilled. You may have to manually enter the Listener
port name.
- Web Service Namespace to Package Mappings page: if you selected
Define custom mapping for namespace to package on the previous panel,
you can enter your custom mapping pairs on this panel by clicking Add.
Alternately, you can click Import to import custom mapping pairs from
a .properties file. The content of the properties
file must be of the format namespace=package .
- Web Service Test page: If you want to test your Web service in
the Web Services Explorer click Launch. Select the
operation you want to test, enter the required information, and click Go.
The result will display in the Status pane.
- Web Service Proxy page: select if you want to generate a proxy,
and select whether or not to enable security for this proxy. You can optionally
select to enter custom namespace to package mappings.
- Web Service client namespace to package mapping page: if you selected
Define custom mapping for namespace to package on the previous panel,
you can enter your custom mapping pairs on this panel by clicking Add.
Alternately, you can click Import to import custom mapping pairs from
a .properties file. The content of the properties
file must be of the format namespace=package .
- 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.
- 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 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.
For more information on EJBs, refer to the EJB application development
documentation.
Important: When creating
a skeleton EJB from a WSDL file, no JNDI name is generated for the newly created
EJB. When this EJB is run in the Unit Test Environment, a warning with code WSVR0038I is
displayed in the console, saying "No JNDI name found for the EJB, a default
binding name based on the home interface will be used." This error does not
impact your Web service. Use the J2EE tooling to assign a JNDI name to the
EJB to avoid this problem.