【问题标题】:Difference between @Path and @Webmethod@Path 和 @Webmethod 之间的区别
【发布时间】:2019-08-08 07:12:50
【问题描述】:

谁能告诉我应该在哪里使用@WebMethod 以及应该在哪里使用@Path 或@RequestMapping

最近我遇到了一个使用@webmethod 的代码,直到现在我一直在使用@path 和@requestmapping 来实现我的网络服务。 嗯,带有 Webmethod 的代码使用的是 SOAP Web 服务。

它与 SOAP 或 REST 有关吗?还是 Java 或 J2EE?

我试过谷歌搜索,但到现在为止都没有成功。

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

【问题讨论】:

  • 我认为这应该会有所帮助:stackoverflow.com/questions/38628374/…
  • @Path 是 JAX-RS 注释,而 @RequestMapping 用于 Spring 应用程序。您没有提到 Spring,所以我认为使用后面的注释对您不起作用。 @WebMethod 是 SOAP 而 @Path REST;非常不同。

标签: web-services jakarta-ee


【解决方案1】:

@Path 是一个 JAX-RS 表示法。 @WebMethod 是标准的 JAX-WS 表示法,它表明该特定方法应作为 WebService 的公共操作公开。

注意: JAX-RS 是处理 RESTful 接口的规范,而 JAX-WS 是对应于 SOAP 的规范。

您可以在此处找到有关标准 JAX-WS 注释的更多详细信息:https://docs.oracle.com/cd/E13222_01/wls/docs92/webserv/annotations.html#wp1040606

【讨论】:

  • 值得注意的是@RequestMapping是Spring。
  • @LutzHorn - 同意。但他的问题与 webmethod 是否与 SOAP 有关。
猜你喜欢
  • 1970-01-01
  • 2015-11-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-26
  • 2012-08-21
  • 2012-11-06
  • 2019-08-01
相关资源
最近更新 更多