当前位置: 动力学知识库 > 问答 > 编程问答 >

Apache Cxf publishing services

问题描述:

I am working on demo project in apache CXF, Every example in the internet is show to publish the service using spring configuration file.

Is there any way to publish the services in simple web project i.e Jsp/Servlets .

What I am think is to publish the Services using following code in 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();

Is this the right way?

Please throw some light.

Regards

Raman

网友答案:

by using jax ws endpoint you can do this.

<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>
分享给朋友:
您可能感兴趣的文章:
随机阅读: