【问题标题】:Can we use org.springframework.ws.server.endpoint.annotation.Endpoint annotated class to create RESTful web service with Spring我们可以使用 org.springframework.ws.server.endpoint.annotation.Endpoint 注释类来创建带有 Spring 的 RESTful Web 服务吗
【发布时间】:2018-02-22 14:04:20
【问题描述】:

我必须在当前提供 SOAP 服务并因此使用 org.springframework.ws.server.endpoint.annotation.Endpoint 的现有应用程序中创建 RESTful Web 服务,所以我可以使用 @Endpoint 注释类而不是 @RestController 来使用 Spring 创建 RESTful Web 服务吗?类有以下方法:

@RequestMapping(value = "/myMethod", method=RequestMethod.GET)
public ResponseEntity<String> restMethod() {
  ...
}

【问题讨论】:

  • No... 这些是基于 SOAP 的端点。

标签: spring rest web-services soap


【解决方案1】:

@Endpoint 注释将一个类标记为 SOAP 端点,它将通过其方法处理 SOAP 请求。而 @RestController,根据它的 javadoc,是“一个方便的注释,它本身用 @Controller@ResponseBody 注释”,这是一个创建REST服务的非常方便的机制。所以你不能使用 @Endpoint 等待它表现得像 @RestController

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-31
    • 1970-01-01
    相关资源
    最近更新 更多