[英]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.