Couple options:

1) You could try doing a:
bus.getExtension(org.apache.cxf.endpoint.ServerRegistry.class).getServers()
and navigate through the Server object returned.  

2) bus.getExtension(DestinationFactoryManager.class)
        .getDestinationFactory("http://cxf.apache.org/transports/http";) 
and cast that to a HTTPTransportFactory and call getRegistry() on that would 
return the registry that the HTTP stuff is using for the destinations.  Could 
likely navigate through some of that as well.

Hope that helps.


Dan




On Jan 27, 2013, at 5:44 PM, Sam777 <[email protected]> wrote:

> Hi there,
> 
> I want to create multiple restful webservice at runtime like
> 
>       /String address = "http://localhost:9001/rest/myService_1";;
>             org.apache.cxf.jaxws.EndpointImpl endpointImpl =
> (EndpointImpl)Endpoint.create(HTTPBinding.HTTP_BINDING, new
> RestWebServiceProvider() );
>            endpointImpl.publish( address );
>            endpointImpl.getInInterceptors().add( ... );
>       .../
>       
> where each webservice will have a different address and
> RestWebServiceProvider is a simple Provider service like      
> 
>       /@WebServiceProvider()
>       @ServiceMode(value = Service.Mode.PAYLOAD)
>       public class RestWebServiceProvider implements Provider<DOMSource> {
>               ...
>       }/
> 
> Now to display info of each webservice created in browser(I guess the
> proper/professional way is JMX..), I will need to access
> EndpointImpl/Service/Server created above BUT I can't quiet figure out how
> to do that. For example, BusFactory.getDefaultBus() doesn't return 
> a handle to retrieve those data.
> 
> The easiest way I can see how to do that is to create a class to keep all
> references of endpontImpl instances created above, e.g.
> 
>   MyEndpointUtil.add( endpointImpl ); // do this right after each
> webservice is created
> 
> Then to get all endpointImpl, I can simply do something like
> 
>  List<EndpointImpl> endpointImplList =
> MyEndpointUtil.getAllMyEndpointImpl();
> 
> to access those info like
> 
>       /for ( EndpointImpl endpointImpl: endpointImplList ) {
>               Server server = endpointImpl.getServer();
>                Service service = endpointImpl.getService();
>                String url = endpointImpl.getPublishedEndpointUrl();
>               ..
>       }/
> 
> Is there an easier way to do that or am I off the track?
> 
> Thanks
> 
> Sam
> 
> 
> 
> 
> --
> View this message in context: 
> http://cxf.547215.n5.nabble.com/Access-all-webservices-created-in-Bus-at-runtime-tp5722307.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to