You can use annotations to associate an implementation
EJB bean with an existing WSDL service contract.
Before you begin
Prerequisites:- Your workspace must contain an EJB 3.0 bean that has been annotated
as a Web service (it must contain the @Stateless annotation).
- You must have an existing Web Services Description Language (WSDL)
service contract.
About this task
To create a Web service:
Procedure
- In the Enterprise Explorer view, double-click your EJB
bean to open the file in the Java™ editor.
- 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.
- 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.
- Save your EJB file.
What to do next
Postrequisite: Now you can Create a Web service from your annotated
Enterprise bean by publishing it to a server.
Note: As
you use annotations to associate your EJB 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.