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

You can use annotations to associate an implementation Java™ bean with an existing WSDL service contract.

Prerequisites:

To create a Web service:

  1. In the Enterprise Explorer view, double-click your Java bean to open the file in the Java editor.

  2. In the editor or Annotations view, specify a value for the wsdlLocation attribute of the @WebService annotation. This value should be the Web address of the WSDL service contract that you want to associate with your bean.

  3. Optional: Use annotations to associate other Java elements with WSDL elements. For example, you might associate a Java method name with a WSDL operation name, or a Java parameter with a WSDL schema element. For detailed information about these and other annotations, see the related reference.

  4. Save your Java file.

Postrequisite: Now you can generate a Web service from your annotated Java bean by publishing it to a server.

Note: As you use annotations to associate your Java bean with a WSDL service contract, the JAX-WS annotations processor ensures that your Java code is consistent with the WSDL contract as required by the JAX-WS and JSR-181 standards. If there are inconsistencies, you will see warnings or errors in the code, along with suggestions for correction.

 

Related tasks

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

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

 

Related reference

JAX-WS annotations reference