Sunday, January 27, 2013

Create a service endpoint implementation for JAX-WS applications with annotations

Before going to steps/procedure creating a service endpoint using JAX-WS annotation, you should read the basic of Endpoint implementation using JAX_WS.


  1. First determine if the service implementation is a JavaBeans endpoint or a Provider endpoint. If you choose to use a JavaBeans endpoint, then determine if you want to use an explicit SEI or if the bean itself will have an implicit SEI.
  2. Annotate the service endpoints. A Java class that implements a Web service must specify either the javax.jws.WebService orjavax.xml.ws.WebServiceProvider annotation. Both annotations must not be present on a Java class. Thejavax.xml.ws.WebServiceProvider annotation is only supported on classes that implement the javax.xml.ws.Provider interface.
    • If you have an explicit service endpoint interface with the Java class, then use the endpointInterface parameter to specify the service endpoint interface class name to the javax.jws.WebService annotation. You can add the @WebMethod annotation to methods of a service endpoint interface to customize the Java-to-WSDL mappings. All public methods are considered as exposed methods regardless of whether the @WebMethod annotation is specified or not. It is incorrect to have an @WebMethod annotation on an service endpoint interface that contains the exclude attribute.
    • If you have an implicit service endpoint interface with the Java class, then the javax.jws.WebService annotation will use the default values for the serviceNameportName, and targetNamespace parameters. To override these default values, specify values for these parameters in the @WebService annotation. If the @WebMethod annotation is not specified, all public methods are exposed including the inherited methods with the exception of methods inherited from java.lang.Object. The exclude parameter of the @WebMethod annotation can be used to control which methods are exposed.
    • If you are using the Provider interface, use the javax.xml.ws.WebServiceProvider annotation on the Provider endpoint.

No comments:

Post a Comment