简体   繁体   中英

Difference between @Path and @Webmethod

Can some one tell me the where should be @WebMethod used and where @Path or @RequestMapping should be used?

Recently I came through a code where @webmethod is used, till now I have been using @path and @requestmapping for implementing my webservices. Well, the code with Webmethod was using SOAP webservices.

Is it something to do with SOAP or REST? or Java or J2EE?

I have tried googling, but no success till now.

@WebMethod(operationName = "GetPendingrequest")
public abstract ERxPendingRequestsCounts getERxPendingCountsForProvider(@WebParam(name = "pvid") BigDecimal pvid)
  throws SystemFault,SecurityFault, IllegalArgumentFault;

@Path is a JAX-RS notation. @WebMethod is the standard JAX-WS notation that tells that this particular method should be exposed as a public operation of the WebService.

Note: JAX-RS is specification that deals with RESTful interfaces while JAX-WS is the corresponding one for SOAP .

You can find more details on standard JAX-WS annotations here: https://docs.oracle.com/cd/E13222_01/wls/docs92/webserv/annotations.html#wp1040606

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM