Hi Micheal ,
I suppose you actually mean create your own ServiceFactoryBean that
extends AbstractServiceFactoryBean.
AbstractServiceFactory is only used for code generation .
You can create new ServiceFactoryBean by extending
ReflectionServiceFactoryBean , JaxwsServiceFactoryBean or
subclassing AbstractServiceFactoryBean. Then use your own
ServiceFactoryBean to create your Servlet :
public class MyCustomServlet extends CXFServlet
{
@Override
public void init(ServletConfig servletConfig)
throws ServletException
{
super.init(servletConfig);
Bus bus = getBus();
BusFactory.setDefaultBus(bus);
YourServiceFactoryBean serviceFactory =
new YourServiceFactoryBean ();
serviceFactory.getServiceConfigurations()
.add(0, new AbstractServiceConfiguration()
// standard JAX-WS service creation
Endpoint.publish("/OtherService", new OtherServiceImpl());
}
}
Regards
Jim
Michael Kleinhenz wrote:
Hi,
I try to get used to the inner workings of cxf. I suppose it is possible
to add new ServiceFactories to cxf, but how would this be done?
If I create a new ServiceFactory by subclassing AbstractServiceFactory,
how do I add it to cxf?
Another thing: the documentation talks about customizing the behaviour
of ReflectionServiceFactoryBean by adding ServiceConfigurations. How do
I add these ServiceConfigurations to cxf in a servlet environment. The
example creates the server from scratch, but I understand that in a
servlet context, the Server instance is started (I think) from CXFServlet..?
I try to do this:
public class MyCustomServlet extends CXFServlet
{
@Override
public void init(ServletConfig servletConfig)
throws ServletException
{
super.init(servletConfig);
Bus bus = getBus();
BusFactory.setDefaultBus(bus);
ReflectionServiceFactoryBean serviceFactory =
new ReflectionServiceFactoryBean();
serviceFactory.getServiceConfigurations()
.add(0, new AbstractServiceConfiguration()
{
.. my programmatically created service setup ..
});
... now, how to set my custom ServiceFactory to be used? ...
// standard JAX-WS service creation
Endpoint.publish("/OtherService", new OtherServiceImpl());
}
}
Thanks,
-- Michael