cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam777 <sam.hu...@hotmail.com>
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  	

	/@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.

Mime
View raw message