Creating a Web service from a Java bean using the IBM WebSphere run-time environment

Prerequisites:

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.

To create a Web service from a bean using the IBM WebSphere run-time environment:

  1. Switch to the J2EE perspective (Window > Open Perspective > J2EE).

  2. In the Project Explorer view, select the bean that you created or imported into the source folder of your Web project.

  3. Click File > New > Other. Select Web Services in order to display the various Web service wizards. Select the Web Service wizard. Click Next.

  4. Web Services panel: select 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.

  5. Object selection page: select the Java bean from which the Web service will be created.

  6. Service Deployment Configuration page: specify the server and client deployment settings.

    1. 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. If you want to use the IBM SOAP run-time environment or the Apache Axis 1.0 run-time environment, refer to the appropriate task.

    2. Select the Web project and EAR in which you want your Web service created. The wizard will create these for you if they do not already exist.

    3. 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, select the WebSphere run-time environment for your client.

    4. 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.

  7. Service Endpoint Interface Selection page: You can select to use an existing service endpoint intferface (SEI) rather than letting the wizard generate one.

  8. 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. Only document/literal is WS-I compliant.

    • Select your security options. Security is not WS-I compliant.

    • Select if you want to exclusively use WSDL 1.1 Mime attachment.

    • Select if you want to customize the package to namespace mappings.

  9. 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. 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 package = namespace .

  10. 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 click Go. The result will display in the Status pane. Click Next.

  11. Web Service Proxy page: if you have selected to generate a proxy, select the proxy security options and select if you want to customize the package to namespace mappings.

  12. Web Service client package to namespace mapping 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. 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 package=namespace. You can also choose to disable data binding and use SOAP elements when generating Java from WSDL.

  13. 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.

  14. 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:

 

Related Concepts

Web services development
Web services run-time environments

Related Tasks
Developing Web services
Using the Web Services Explorer

Related Reference
WSDL documents