Apache Cxf发布服务

时间:2014-11-12 10:19:53

标签: web-services cxf

我正在使用apache CXF进行演示项目,互联网上的每个示例都显示使用spring配置文件发布服务。

有没有办法在简单的Web项目中发布服务,即Jsp / Servlets。

我认为使用servletContext.xml中的以下代码发布服务

HelloWorldImpl implementor = new HelloWorldImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(HelloWorld.class);
svrFactory.setAddress("http://localhost:9000/helloWorld");
svrFactory.setServiceBean(implementor);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
svrFactory.create();

这是正确的方法吗?

请稍微说清楚。

此致 拉曼

1 个答案:

答案 0 :(得分:0)

通过使用jax ws端点,您可以执行此操作。

<jaxws:endpoint id="queryAssetService" implementor="#queryAssetImpl"
		address="/services/queryAsset" xmlns:tns="namespace"
		serviceName="tns:serviceName">
	 <jaxws:features>
			<bean class="org.apache.cxf.feature.LoggingFeature" />
		</jaxws:features>
	</jaxws:endpoint>

相关问题