Jax-ws relative to endpointinterface

defined a Java interface with @WebService annotation Compiled code that went fine

Example:

@WebService public interface HelloWorldIfc{ 

Now I tried to define the endpointinterface as

  @WebService (endpointInterface = "com.ws.HelloWorldIfc") public interface HelloWorldIfc{ 

Compiled file too

So - should I define an endpoint interface on an interface or on an implementation class?
this attribute of any use - what is its purpose?
what happens if I do not define it - what will I lose?
Thanks,
Satish

+7
source share
2 answers

The JAX-WS specification does this in section 3.3, page 30:

You can use the endpointInterface attribute to separate between the executing class and the interface. Basically, this determines what will be displayed on your wsdl:portType when the service is deployed and wsdl:definition generated.

If you do not define endpointInterface , all public methods of the annotated class will appear in wsdl:operation (unless you influence this behavior with @WebMethod annotations).

If you define endpointInterface , it must point to some type that the annotated class implements (or, well, itself, as shown in your question). Then, public methods of this type are used to map wsdl:portType instead of methods of the annotated class.

To summarize: defining endpointInterface only makes sense if you use @WebService on the implementation class and want your WSDL to be generated based on the interface that it implements. In your current setup, where you use annotation on the com.ws.HelloWorldIfc interface, there really is no difference. Thus, you do not lose anything, just skipping it. Annotations are useful if you want your implementation class to provide public methods that should not be part of the generated WSDL.

+15
source

Defining endpointInterface is useful because the annotations of @WebParam interface methods work without defining them again in the implementation class.

0
source

All Articles