Hi,
I'm new to CXF.

I try to use JAX-WS to and I want to have severals web-services with the same java class for the implementation.
For these web-services, I want to use the same bean.

Each web-service has more and more fontions, but every "client" can't have access to all fonctions (url dependant). I create inherited class to get a different @WebService annotation for each web-service.
The bean will be the last derived class.

@WebService(targetNamespace = "http://service2/";, endpointInterface = "my.class.Service2", portName = "Service2Port", serviceName = "Service2Service")
class ServiceImpl2 extends ServiceImpl1 {
}

@WebService(targetNamespace = "http://service1/";, endpointInterface = "my.class.Service1", portName = "Service1Port", serviceName = "Service1Service")
class Service1Impl implement Service1, Service2{
}

The cxf configuration file.
<jaxws:endpoint xmlns:tns="http://service1/"; id="id_service1"
        implementor="#commonBean"
        endpointName="tns:Service1Port"
        serviceName="tns:Service1" address="/Service1Test">
</jaxws:endpoint>

<jaxws:endpoint xmlns:tns="http://service2/"; id="id_service2"
        implementor="#commonBean"
        endpointName="tns:Service2Port"
        serviceName="tns:Service2" address="/Service2Test">
</jaxws:endpoint>

<bean id="commonBean" class="my.class.Service2Impl" init-method="start" >
...
</bean>

But for each web-service I got the same WSDL wich is the Service2.wsdl.


When I do that with XFire and it works fine. The service.xml file looks like:

<service>
<name>Service1</name>
<serviceClass>my.interface.Service1</serviceClass>
<scope>application</scope>
<serviceBean>#commonBean</serviceBean>
</service>

<service>
<name>Service2</name>
<serviceClass>my.interface.Service2</serviceClass>
<scope>application</scope>
<serviceBean>#commonBean</serviceBean>
</service>

<bean id="commonBean" class="my.class.Service12Impl" init-method="start" >
</bean>


class Service12Impl implement Service1, Service2 {
  ...
}


Is it possible to do the same with CXF ?

Thank a lot,

Bertrand

Reply via email to