You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by liw <pa...@yahoo.com> on 2009/07/08 06:40:03 UTC
Which API can be used to get service interface class for a given
service?
Hi,
We are migrating from xfire to cxf 2.1. We need to get the service interface
class for a given serviceName.
The following is what we have with xfire.
XFire xfire = (XFire)BeanFactory.getBeanInstance("xfire");
Service origRegisteredService =
xfire.getServiceRegistry().getService(serviceName);
Class serviceInterfaceClass =
getXFireServiceObject(serviceName).getServiceInfo().getServiceClass();
With cxf, I am able to get the service for a given serviceName using the
following code.
private Service getCXFServiceObject(String serviceName)
{
Bus bus = (Bus)BeanFactory.getBeanInstance(AppConstants.CXF_BUS);
ServerRegistry serverRegistry =
bus.getExtension(ServerRegistry.class);
for (Server server : serverRegistry.getServers()) {
Service service = server.getEndpoint().getService();
if (service.getName().getLocalPart().equals(serviceName)) {
return service;
}
}
return null;
}
However, after I get the service, I am not able to find any cxf API to get
service interface class for a given service.
Does anyone have any idea?
Thanks in advance,
Li
--
View this message in context: http://www.nabble.com/Which-API-can-be-used-to-get-service-interface-class-for-a-given-service--tp24385234p24385234.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Which API can be used to get service interface class for a given service?
Posted by Daniel Kulp <dk...@apache.org>.
On Wed July 8 2009 3:43:33 am liw wrote:
> I found the solution. Using service.get() API solved the problem.
Right. Most of the stuff is hung off the service model someplace as a
property. Just need to find the right key or the right object it's hanging
off of. (example: the ServiceInfo, EndpointInfo, or InterfaceInfo).
Dan
>
> Thanks,
>
> Li
>
> liw wrote:
> > Hi,
> >
> > We are migrating from xfire to cxf 2.1. We need to get the service
> > interface class for a given serviceName.
> >
> > The following is what we have with xfire.
> >
> > XFire xfire = (XFire)BeanFactory.getBeanInstance("xfire");
> > Service origRegisteredService =
> > xfire.getServiceRegistry().getService(serviceName);
> > Class serviceInterfaceClass =
> > getXFireServiceObject(serviceName).getServiceInfo().getServiceClass();
> >
> >
> > With cxf, I am able to get the service for a given serviceName using the
> > following code.
> >
> > private Service getCXFServiceObject(String serviceName)
> > {
> > Bus bus = (Bus)BeanFactory.getBeanInstance(AppConstants.CXF_BUS);
> > ServerRegistry serverRegistry =
> > bus.getExtension(ServerRegistry.class);
> > for (Server server : serverRegistry.getServers()) {
> > Service service = server.getEndpoint().getService();
> > if (service.getName().getLocalPart().equals(serviceName)) {
> > return service;
> > }
> > }
> > return null;
> > }
> >
> > However, after I get the service, I am not able to find any cxf API to
> > get service interface class for a given service.
> >
> > Does anyone have any idea?
> >
> > Thanks in advance,
> >
> > Li
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: Which API can be used to get service interface class for a
given service?
Posted by liw <pa...@yahoo.com>.
I found the solution. Using service.get() API solved the problem.
Thanks,
Li
liw wrote:
>
> Hi,
>
> We are migrating from xfire to cxf 2.1. We need to get the service
> interface class for a given serviceName.
>
> The following is what we have with xfire.
>
> XFire xfire = (XFire)BeanFactory.getBeanInstance("xfire");
> Service origRegisteredService =
> xfire.getServiceRegistry().getService(serviceName);
> Class serviceInterfaceClass =
> getXFireServiceObject(serviceName).getServiceInfo().getServiceClass();
>
>
> With cxf, I am able to get the service for a given serviceName using the
> following code.
>
> private Service getCXFServiceObject(String serviceName)
> {
> Bus bus = (Bus)BeanFactory.getBeanInstance(AppConstants.CXF_BUS);
> ServerRegistry serverRegistry =
> bus.getExtension(ServerRegistry.class);
> for (Server server : serverRegistry.getServers()) {
> Service service = server.getEndpoint().getService();
> if (service.getName().getLocalPart().equals(serviceName)) {
> return service;
> }
> }
> return null;
> }
>
> However, after I get the service, I am not able to find any cxf API to get
> service interface class for a given service.
>
> Does anyone have any idea?
>
> Thanks in advance,
>
> Li
>
>
>
>
>
>
>
>
--
View this message in context: http://www.nabble.com/Which-API-can-be-used-to-get-service-interface-class-for-a-given-service--tp24385234p24386921.html
Sent from the cxf-user mailing list archive at Nabble.com.