cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam777 <>
Subject Access all webservices created in Bus at runtime?
Date Sun, 27 Jan 2013 22:44:07 GMT
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  	

	@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 =
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?



View this message in context:
Sent from the cxf-user mailing list archive at

View raw message