Java 调用SpringWeb服务

Java 调用SpringWeb服务,java,web-services,spring,spring-ws,Java,Web Services,Spring,Spring Ws,我正在尝试调用SpringWeb服务,在浏览器中使用下面的url服务“myservice”应该返回XML,即基于@RequestMapping注释的下面的url正确吗 > http://localhost:8080/mywebapp/myservice/feeds/allFeeds.xml/ import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; impor

我正在尝试调用SpringWeb服务,在浏览器中使用下面的url服务“myservice”应该返回XML,即基于@RequestMapping注释的下面的url正确吗

> http://localhost:8080/mywebapp/myservice/feeds/allFeeds.xml/


import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("myservice")
public class TheController {

    private TheService TheServiceWS;

    public TheController(TheService TheServiceWS) {
        this.TheServiceWS = TheServiceWS;
    }

    @RequestMapping(value = "feeds/allFeeds.xml", produces = MediaType.APPLICATION_XML_VALUE)
    @ResponseBody
    public String getValues() {
        return TheServiceWS.getAllFeeds();
    }

}

我的问题是:

@RequestMapping注释值“myservice”不正确


应该是“mywebservice”

如果web服务以XML形式返回,则它是SOAP web服务的原始版本。在这种情况下,您无法使用@RequestMapping构建web服务。@RequestMapping用于构建REST web服务


在这种情况下,您应该使用SpringWS。您必须用@Endpoint注释该类才能创建web服务端点。在该端点中,使用@Payloadroot创建请求映射。请参阅

这取决于应用程序的部署位置。另外,只是猜测一下,试试
allFeeds.xml
而不是
allFeeds.xml/
您的web.xml是如何配置的?