Creating a Java bean skeleton from a WSDL document using the Apache Axis run-time environment
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:
- If you are using the Apache Jakarta Tomcat servlet container as your server, 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
- If you are using a WebSphere server, create a dynamic Web project targeted to the appropriate server 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 import a WSDL file into the Web Content folder of the Web project. You can only use a WSDL file that contains a service element.
To create a Web service from a WSDL file using the Apache Axis 1.0 run-time environment:
- Switch to the J2EE perspective (Window > Open Perspective > J2EE).
- In the Project Explorer view, select the WSDL file that you created or imported into the Web Content folder of your Web project.
- 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 Skeleton 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 ../../com.ibm.etools.wsi.test.tools.validate.doc/tasks/tmonitor.html
- Web Service Selection page: Enter the URI to the WSDL, WSIL, or HTML file that will be used to generate the Java bean. If you have selected the WSDL file before starting the wizard, this information should be prefilled. 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 Apache Axis 1.0 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 IBM WebSphere run-time environments, refer to the appropriate task.
- Select the Web project in which you want your Web service created. The wizard will create this 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, select the WebSphere run-time environment for your client.
- Web Services Skeleton Java Bean Configuration page: Select the folder where the generated Java will be stored. If you want to review or edit the mappings between packages and namespaces, select the Define custom mapping for namespace to package check box. Click Next.
- Web Service Namespace to Package 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. Click Next.
- 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.
- 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 create custom mappings between namespaces and packages. Click Next.
- 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: 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.
- 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.
Parent topic
Creating Web services with the Apache Axis run-time environment
Related Concepts
Tools for Web services development
Web services development
Web services run-time environments
Related Tasks
Developing Web services
Using the Web Services ExplorerRelated Reference
WSDL documents