Expose Core Services as Web Services

Expose Core Services as Web Services

The DSB provide a simple way to expose core services as Web services without any extra configuration. The only things that is needed are :

  1. Add JAX-WS annotations to core services or generate your service from a WSDL generation tool (Apache CXF is a good choice).
  2. Adding the core service to the right fractal composite
  3. There is no 3

To illustrate this feature, we provide a sample to expose a simple TestService service as Web service.

Create your interface

TestService interface

In this sample, we start from a JAXWS annotated Java interface. This is the only thing to check in this step.

Create your service

Creating your service means implement the interface we just defined in the previous step. Now we have to create a Fractal component which implement the JAXWS annotated TestService interface.

Fractal Component
  • As a Fractal component, you MUST check that you put all the Fractal annotations (@FractalComponent, @Provides, @LifeCycle)
  • This component MUST implements the TestService interface

Add service to the architecture

Once the Fractal component has been created, you have to add it to the component architecture provided by the DSB. For now, it is only possible at configuration time by adding the component at the right place. By default, the Tools.fractal definition file located in trunk/research/commons/dsb/distributions/dsb-distribution/src/main/resources (or in your own distribution) contains a WebServiceManagerImpl (org.petalslink.dsb.kernel.tools.ws.WebServiceManagerImpl) component which will detect JAXWS annotated components defined in the Tools.fractal composite and which will expose them automatically at startup on the management port (the same Petals ESB uses).

Adding your component is just instanciating it in Tools.fractal like this:

Component definition

That's all! Your TestService is now exposed by the DSB at startup and is available at : TODO

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.