Skip to main content
Jump to: navigation, search

Publish ECF Remote Service As WebService

With ECF, the remote services can be published "automatically" as web service.

Below is an example of doing this for an existing remote service example available here.

The code is currently located on the ECF OSUOSL site. Here's the CVS information for this site:



Publishing the remote service as WS

Below is a short description of how to publish as a web service the remote Hello Example Service defined here.

// Lookup IRemoteServiceReference
IRemoteServiceReference[] serviceReferences = container.getContainerAdapter().getRemoteServiceReferences(targetID, IHello.class.getName(), null);
// Get remote service for reference
if(serviceReferences == null ||serviceReferences.length == 0)
	throw new ECFException("The remote reference is not available : "+IHello.class.getName());
IRemoteServiceReference reference = serviceReferences[0];			
IRemoteService remoteService = container.getContainerAdapter().getRemoteService(reference);
ISoapServerContainerAdapter soapContainerAdapter =  (ISoapServerContainerAdapter) ContainerFactory.getDefault().createContainer().getAdapter(ISoapServerContainerAdapter.class);
//"hello" It will be the web service name and "*" the allowedMethod
soapContainerAdapter.deployRemoteServiceAsWebService("hello", "*", remoteService);

After it the web service can be consumed through the endpoint "http://localhost:8080/services/hello";

Back to the top