简体   繁体   English

如何在Spring Mvc 4中同时运行Soap和Json这两个Web服务?

[英]How to have two web services that is both Soap and Json run together in Spring Mvc 4?

My web Application is built on Spring Mvc 4 boot less Completely Annotation based configuration using Restful services .Now as per demand I need to integrate Soap to my existing Spring Mvc Application. 我的Web应用程序基于Spring Mvc 4启动,而不是使用Restful服务完全基于注释的配置。现在我需要将Soap集成到我现有的Spring Mvc应用程序中。 How do I configure Soap along with Restful Spring Mvc Application with annotation based configuration? 如何使用基于注释的配置配置Soap以及Restful Spring Mvc Application?

We are doing exactly that on my current project. 我们正在对我当前的项目做这件事。 It is just a matter of configuring the appropriate end points in the cxf.xml. 只需在cxf.xml中配置适当的端点即可。

Something like this: 像这样的东西:

<jaxrs:server id="restEndpoint" address="/whatever">
    <jaxrs:serviceBeans>
        <ref bean="restEndpointBean" />
    </jaxrs:serviceBeans>
</jaxrs:server>


....

<jaxws:endpoint xmlns:tns="http://my.url/soapserv/connect"
    id="ConnectSoap" address="/connect" serviceName="tns:connect"
    endpointName="tns:connect" implementor="#connectSoapImpl">
    <jaxws:binding>
        <soap:soapBinding version="1.2" mtomEnabled="true" />
    </jaxws:binding>
</jaxws:endpoint>

For the SOAP services they are bound using the cfl.xml configuration, there are no annotations specific for this. 对于使用cfl.xml配置绑定的SOAP服务,没有特定于此的注释。 Obviously you will need @Component . 显然你需要@Component

For the REST services they utilize the standard REST annotations: 对于REST服务,它们使用标准REST注释:

@GET
@Path("foo/{id}")
public Response getFooId(@PathParam("id") String id)

or 要么

@RequestMapping(value = "/foo", method = RequestMethod.PuT)
public @ResponseBody PaymentModel updateFoo(
                                       @RequestBody PaymentModel request) {

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我们的应用程序中可以同时包含RESTful和SOAP Web服务吗 - Can we have both RESTful and SOAP Web Services in our application 用于单个应用程序的REST和SOAP Web服务 - Both REST and SOAP Web Services for a single application 如何在Spring Soap Web服务中注册自定义端点映射 - How to register a custom Endpoint Mapping in Spring Soap web services 如何使用注释在 SOAP Spring Web 服务中验证请求 - How to validate request in SOAP Spring Web Services using annotations 如何在Soap Web服务中为单个请求获得两个响应 - How to get two responses for a single request in soap web services 如何用返回Spring MVC + Hibernate Restful Web Service的JSON对象填充Table? - How to populate Table with JSON object which is return Spring MVC+Hibernate restful web services? JBoss中的Spring Web Services-两个动态的wsdl,它们的locationUri不同,但是都可以在两个位置中访问 - Spring Web Services within JBoss - Two dynamic wsdl's with different locationUri, but both can be accessed in both locations 如何调试 soap web 服务? - How to debug soap web services? 两个Web服务SOAP无法与Wildfly 9.0.2一起使用 - two web services SOAP not working with wildfly 9.0.2 Spring MVC,两个按钮使用一种形式,它们如何协同工作? - Spring MVC, two buttons work with one form, how they work together?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM