Hello,
adding an implementorClass="Service2" attribute to the jaxws:endpoint works.
I have now different wsdl and different functions for each service.
<jaxws:endpoint xmlns:tns="http://service1/" id="id_service1"
implementor="#commonBean"
implementorClass="my.interface.Service1"
endpointName="tns:Service1Port"
serviceName="tns:Service1" address="/Service1Test">
</jaxws:endpoint>
<jaxws:endpoint xmlns:tns="http://service2/" id="id_service2"
implementor="#commonBean"
implementorClass="my.interface.Service2"
endpointName="tns:Service2Port"
serviceName="tns:Service2" address="/Service2Test">
</jaxws:endpoint>
Thank you.
Bertrand
*
*
You MIGHT be able to add an implementorClass="Service2" attribute to the
jaxws:endpoint. That would tell it the class to actually look at. I'm not
100% sure that works though.
It would probably be good to provide an endpointInterface attribute to
jaxws:endpoint to override the value in the @WebService annotation. We can
pretty much override everything else (endpoint name, service name, etc...).
Overriding that would make sense. Feel free to log a feature request (and a
patch would be REAL nice). :-)
Dan
On Thursday 24 February 2011 5:55:18 AM Bertrand TROLARD wrote:
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