Topic
  • 5 replies
  • Latest Post - ‏2012-10-16T22:20:23Z by SystemAdmin
SystemAdmin
SystemAdmin
590 Posts

Pinned topic Expose OSGi service via JAX-RS in Liberty

‏2012-10-16T07:56:53Z |
Is it possible to expose OSGi services via JAX-RS using the Liberty profile? I'd like to use OSGi as the componentization model for my application and be able to provide REST interfaces to it. Any pointers would be appreciated.

  • Sumant
  • makandre
    makandre
    3 Posts

    Re: Expose OSGi service via JAX-RS in Liberty

    ‏2012-10-16T14:17:24Z  
    Hi Sumant,

    You can actually create JAX-RX services inside OSGi bundles, and those services can be accesses when deploying to the Liberty profile.

    However, you cannot expose OSGi services as JAX-RX services. To do this you'll need SCA, which is not supported on the Liberty profile today.

    Hope this helps.

    Andrew
  • makandre
    makandre
    3 Posts

    Re: Expose OSGi service via JAX-RS in Liberty

    ‏2012-10-16T14:41:29Z  
    • makandre
    • ‏2012-10-16T14:17:24Z
    Hi Sumant,

    You can actually create JAX-RX services inside OSGi bundles, and those services can be accesses when deploying to the Liberty profile.

    However, you cannot expose OSGi services as JAX-RX services. To do this you'll need SCA, which is not supported on the Liberty profile today.

    Hope this helps.

    Andrew
    Oops, I meant to say JAX-RS services instead of JAX-RX

    Andrew
  • SystemAdmin
    SystemAdmin
    590 Posts

    Re: Expose OSGi service via JAX-RS in Liberty

    ‏2012-10-16T16:40:49Z  
    • makandre
    • ‏2012-10-16T14:17:24Z
    Hi Sumant,

    You can actually create JAX-RX services inside OSGi bundles, and those services can be accesses when deploying to the Liberty profile.

    However, you cannot expose OSGi services as JAX-RX services. To do this you'll need SCA, which is not supported on the Liberty profile today.

    Hope this helps.

    Andrew
    Hi Andrew,

    Thanks for your response. Any pointers to how I can create JAX-RS services inside OSGi bundles? The Liberty tutorials I've seen so far don't show that combination.

    Sumant
  • makandre
    makandre
    3 Posts

    Re: Expose OSGi service via JAX-RS in Liberty

    ‏2012-10-16T17:47:26Z  
    Hi Andrew,

    Thanks for your response. Any pointers to how I can create JAX-RS services inside OSGi bundles? The Liberty tutorials I've seen so far don't show that combination.

    Sumant
    Hi Sumant,

    Start by creating an OSGi bundle:

    • On the first page of the wizard, set the target runtime of the bundle to the Liberty Profile.
    • Then in the configuration section, select the Custom checkbox and click on the Advanced button. This opens the project facets page.
    • In that page, select Dynamic Web Module and JAX-RS (REST Web Services) checkboxes. Click OK.
    • Then click Finish in the wizard.
    • Open the project's manifest file, in the Dependencies tab, import the com.ibm.websphere.jaxrs.server package.

    That should get you started with the proper project configuration and you should be able create JAX-RS service in it as you normally would.

    Andrew
  • SystemAdmin
    SystemAdmin
    590 Posts

    Re: Expose OSGi service via JAX-RS in Liberty

    ‏2012-10-16T22:20:23Z  
    • makandre
    • ‏2012-10-16T17:47:26Z
    Hi Sumant,

    Start by creating an OSGi bundle:

    • On the first page of the wizard, set the target runtime of the bundle to the Liberty Profile.
    • Then in the configuration section, select the Custom checkbox and click on the Advanced button. This opens the project facets page.
    • In that page, select Dynamic Web Module and JAX-RS (REST Web Services) checkboxes. Click OK.
    • Then click Finish in the wizard.
    • Open the project's manifest file, in the Dependencies tab, import the com.ibm.websphere.jaxrs.server package.

    That should get you started with the proper project configuration and you should be able create JAX-RS service in it as you normally would.

    Andrew
    Thanks Andrew! Much appreciated.