sticky_elbows
sticky_elbows

Reputation: 1514

difference between EndPoint and WebService - Spring

What is the difference between @EndPoint and @WebService? Looks like they both are used to define an endpoint which is providing some services to its clients.

@WebService
public class Hello {
    //
}

and

@EndPoint
public class Hello{
    //
}

are the same or what difference do they have?

Upvotes: 2

Views: 1629

Answers (1)

Madhu Bhat
Madhu Bhat

Reputation: 15263

@Endpoint

@Endpoint is from org.springframework.ws.server.endpoint.annotation.Endpoint and indicates that an annotated class is an "Endpoint" (e.g. a web service endpoint). It's used to create a custom endpoint when you are leveraging Spring framework.

@ WebService

@WebService is from javax.jws.WebService and marks a Java class as implementing a Web Service, or a Java interface as defining a Web Service interface. It is defined by JSR-181 which is a standard way of declaring WebService endpoints in the spirit of JavaEE 5+. In case you are using leveraging Spring framework, you cannot use the @WebService annotation since Spring can't scan the classes annotated with it or invoke it.

Sources:

https://docs.oracle.com/javaee/5/api/javax/jws/WebService.html

https://docs.spring.io/spring-ws/site/apidocs/org/springframework/ws/server/endpoint/annotation/package-summary.html

http://forum.spring.io/forum/spring-projects/web-services/114849-endpoint-vs-webservice

Upvotes: 2

Related Questions