Creating a Web service from an annotated Java bean by using a wizard

After annotating a Java™ bean, you can generate a Web service application by using the Web services wizard. With the wizard, you can create a WSDL file in your Web services project before you deploy the application to a server.

Prerequisite: For a Java bean in your workspace, have specified Web services annotations, including at least the @WebService annotation.

Note: If the bean already has a @javax.jws.WebService annotation, many of the fields in the wizard will be disabled because the wizard does not need to generate a delegate bean for you. You will only be able to select to generate a WSDL file. If you have added only the @javax.jws.WebService to your Java bean and want to enable other options such as SOAP 1.2 binding or MTOM, you should exit the wizard and either remove the annotation or proceed to create the Web service using the annotations documentation. The wizard will not allow you to append new annotations to a pre-existing partially annotated bean. To create a Web service from an annotated Java bean:

  1. In the menu bar, click

    File | New | Other.

  2. In the New window, click

    Web Services | Web Service. Click Next.

  3. In the Web Services wizard, select Bottom up Java bean Web Service in the

    Web service type list.

  4. In the

    Service implementation field, type the name of the Java bean that implements your Web service, or use the Browse button to select this bean.

  5. Under

    Configuration:

    1. Verify that the server is IBM® WebSphere® Application Server version 7.0 or 6.1. If not, click

      Server to select it.

    2. Verify that the Web service runtime is the IBM WebSphere JAX-WS runtime. If not, click

      Web service runtime to select it.

    3. Click

      Service project to select the project that implements your Web service.

    4. Click

      Service EAR project to select the application project that contains your Web service.

  6. Click Next.

  7. If you want to create a Web Services Description Language (WSDL) service contract from your Java bean, select the

    Generate WSDL into the project check box. A WSDL file for your Web service will be created in the

    WebContent\WEB-INF\wsdl folder of the project that implements your Web service.

  8. Click Finish to complete the wizard

Your Java bean is published as a Web service on the server that you specified. If the level of service generation that you selected in the wizard was Start or Test, your Web service is also started.

Note: If you used the @BindingType annotation in your Java bean to specify a WSDL 1.1 SOAP 1.2 binding, the wizard generates a WSDL file with this type of binding.

For more information about the Web services wizard, including other options for your Web service, see the related tasks.

 

Related tasks

Creating a Web service from an annotated Java bean by publishing to a server

Creating a Web service from a Java bean and a WSDL file

Using the Web services wizard