The Web Service wizard assists you in creating a skeleton bean
from an existing WSDL document. The skeleton bean contains a set of methods
that correspond to the operations described in the WSDL document. When the
bean is created, each method has a trivial implementation that you replace
by editing the bean.
Prerequisites:
- Create a dynamic Web project as described in Creating a WebSphere® Server and Web project.
It is strongly suggested that you start the server before running the Web
service wizard since it may take several minutes to start the WebSphere Application
Server 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.
- Create or discover and import a WSDL document into the Web project. You
can only use a WSDL file that contains a service element.
To create a skeleton Java™ bean from a WSDL document using the WebSphere JAX-RPC
runtime environment:
- 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 bean Web service, and select the WSDL file you
have created or imported.
- Click File > New > Other. Select Web Services in
order to display the various Web service wizards. Select the Web Service wizard.
Click Next.
- Web Services page: select Top down Java bean Web service as your Web service
type. You can optionally choose to do the following:
- 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
when appropriate.
- 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
target server. If any changes to the endpoints of the WSDL file are required
they will be made in this stage.
- Start: this will start the server once the service has been installed
on it.
- 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: the default runtime is displayed. If you
want to deploy your service to a different runtime click the link to specify
a different runtime.
- Select the service project: 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.
- 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
- Web Service Skeleton Java Bean Configuration page:
- Skeleton folder: enter the location where you want the Java bean
skeleton to be created.
- Set the service deploy scope. This indicates how to deploy the server
implementation. Application uses one instance of the implementation class
for all requests. Request creates a new instance of the implementation class
for each request. Session creates a new instance of the implementation class
for each session.
- Optionally, you can select if you want security enabled for this Web service;
security is not WS-I compliant.
- Define custom mapping for namespace to package: If you want to review
or edit the mappings between packages and namespaces, select this checkbox.
- Web Service Namespace to Package Mappings page: The Web services
wizard generates a number of Java files from the specified WSDL. By default
it will create package names based on the namespaces specified in the WSDL
file. To override this default behavior you can specify your own package
names for some or all of the namespaces in the WSDL file. 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.
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 Proxy page: If you have selected to generate a proxy,
this page shows the options for the proxy. It lists the folder where the proxy
will be generated, and you can optionally enable security for the proxy, and
create custom mappings between namespaces and packages.
- Web Service client namespace to package mapping 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.
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 Publication page: If you have selected to publish your
Web service to a UDDI registry, use this page to launch the Web Services Explorer
and select the UDDI registry to which the Web service will be published. 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. Since this is a Java bean
skeleton with trivial method implementation, a value of -3 will be returned.
- 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.