You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Niklas Gustavsson <ni...@protocol7.com> on 2008/04/18 11:54:28 UTC

Expose OSGi service as a web service

Hi

I got a requirement to be able to selectably expose OSGi services as a
SOAP based web service. My current thinking is to use a extender
bundle that interrogates other installed bundles for services declared
to be a web service. A service would be declared for web service
exposure using either using manifest declarations or service
properties. Another approach would of course be the register with a
web service publication service (similar to HttpService) but since web
service frameworks are quite good at exposing Java classes directly
I'm thinking I prefer the former model.

I haven't been able to locate much on this using good ol' Google. Does
it sound like a good design? Anyone got any experiences on doing
anything similar?

/niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Expose OSGi service as a web service

Posted by Marcel Offermans <ma...@luminis.nl>.
On Apr 19, 2008, at 9:32 , Guillaume Nodet wrote:

> I would recommend using Apache CXF instead of XFire.  CXF is a bit of
> the next XFire version, and XFire is not developped anymore.

Agreed, like I said, I did this a couple of years ago, when CXF did  
not exist yet. I either had the choice between Axis 1.0 and XFire. The  
latter then turned out much easier to embed for me, but now CXF seems  
the logical choice.

> Exposing a bean as an HTTP service is just a matter of a few lines  
> of xml
> configuration.

That's easy enough, and a nice alternative to listening to the service  
registry, picking up anything with JSR-181 annotations.

I guess anyone doing "enterprise" style development on OSGi should  
look at ServiceMix 4!

Greetings, Marcel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Expose OSGi service as a web service

Posted by Guillaume Nodet <gn...@gmail.com>.
I would recommend using Apache CXF instead of XFire.  CXF is a bit of
the next XFire version, and XFire is not developped anymore.  Exposing
a bean as an HTTP service is just a matter of a few lines of xml
configuration.

http://svn.apache.org/repos/asf/servicemix/smx4/features/trunk/examples/cxf-osgi/src/main/resources/META-INF/spring/beans.xml

Using spring DM, we could easily use an existing service instead of
simply giving the class name.   Also note that this example uses CXF
and expose the service over HTTP using the OSGi HTTP service.

This example can be deployed onto ServiceMix Kernel which is based on
Felix.   If you want to have a look at it, have a look at
http://servicemix.apache.org/smx4/cxf-examples.html, which contains
very basic instructions on how to deploy this sample (ServiceMix 4 is
evolving quite quickly, so if you have any problems, join our mailing
list and we'll fix it asap).


On Fri, Apr 18, 2008 at 2:20 PM, Marcel Offermans
<ma...@luminis.nl> wrote:
> On Apr 18, 2008, at 14:08 , Niklas Gustavsson wrote:
>
>
> > On Fri, Apr 18, 2008 at 2:01 PM, Marcel Offermans
> > <ma...@luminis.nl> wrote:
> >
> > > This is what we have done for "remoting" OSGi services (either as SOAP
> or
> > > REST services or even JMX mbeans). The remoting bundle just listens for
> > > services with either a property (or you can even use @annotations if you
> > > don't mind running on at least Java 5).
> > >
> >
> > Yeah, I forgot to mention using the JSR-181 annotations. Funny enough
> > since it's the way I'm currently thinking about going forward :-)
> >
>
>  That's what we did too, because those then allow you to simply feed those
> into your SOAP framework of choice.
>
>
>
> > For the remoting bundle, are you using something openly available?
> >
>
>  We created a bundle based on XFire, but this was already done about two
> years ago and it was part of a commercial project. It should not be too hard
> though to bundle up XFire or something similar and either use the
> HttpService or embed a webserver in that same bundle.
>
>  Greetings, Marcel
>
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>  For additional commands, e-mail: users-help@felix.apache.org
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Expose OSGi service as a web service

Posted by Marcel Offermans <ma...@luminis.nl>.
On Apr 18, 2008, at 14:08 , Niklas Gustavsson wrote:

> On Fri, Apr 18, 2008 at 2:01 PM, Marcel Offermans
> <ma...@luminis.nl> wrote:
>> This is what we have done for "remoting" OSGi services (either as  
>> SOAP or
>> REST services or even JMX mbeans). The remoting bundle just listens  
>> for
>> services with either a property (or you can even use @annotations  
>> if you
>> don't mind running on at least Java 5).
>
> Yeah, I forgot to mention using the JSR-181 annotations. Funny enough
> since it's the way I'm currently thinking about going forward :-)

That's what we did too, because those then allow you to simply feed  
those into your SOAP framework of choice.

> For the remoting bundle, are you using something openly available?

We created a bundle based on XFire, but this was already done about  
two years ago and it was part of a commercial project. It should not  
be too hard though to bundle up XFire or something similar and either  
use the HttpService or embed a webserver in that same bundle.

Greetings, Marcel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Expose OSGi service as a web service

Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Fri, Apr 18, 2008 at 2:01 PM, Marcel Offermans
<ma...@luminis.nl> wrote:
>  This is what we have done for "remoting" OSGi services (either as SOAP or
> REST services or even JMX mbeans). The remoting bundle just listens for
> services with either a property (or you can even use @annotations if you
> don't mind running on at least Java 5).

Yeah, I forgot to mention using the JSR-181 annotations. Funny enough
since it's the way I'm currently thinking about going forward :-)

For the remoting bundle, are you using something openly available?

/niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Expose OSGi service as a web service

Posted by Marcel Offermans <ma...@luminis.nl>.
On Apr 18, 2008, at 11:54 , Niklas Gustavsson wrote:

> I got a requirement to be able to selectably expose OSGi services as a
> SOAP based web service. My current thinking is to use a extender
> bundle that interrogates other installed bundles for services declared
> to be a web service. A service would be declared for web service
> exposure using [...] service properties.

This is what we have done for "remoting" OSGi services (either as SOAP  
or REST services or even JMX mbeans). The remoting bundle just listens  
for services with either a property (or you can even use @annotations  
if you don't mind running on at least Java 5).

> [...] since web service frameworks are quite good at exposing Java  
> classes directly
> I'm thinking I prefer the former model.

Agreed.

Greetings, Marcel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Expose OSGi service as a web service

Posted by dishmily <en...@hotmail.com>.
hi,

someone has used Axis2 as bundles to implementieren web service in osgi
container. 

http://www.nabble.com/-Fwd:--Axis2--Starting-a-JAXWS-service-in-another-bundle--td15638094.html






Niklas Gustavsson wrote:
> 
> Hi
> 
> I got a requirement to be able to selectably expose OSGi services as a
> SOAP based web service. My current thinking is to use a extender
> bundle that interrogates other installed bundles for services declared
> to be a web service. A service would be declared for web service
> exposure using either using manifest declarations or service
> properties. Another approach would of course be the register with a
> web service publication service (similar to HttpService) but since web
> service frameworks are quite good at exposing Java classes directly
> I'm thinking I prefer the former model.
> 
> I haven't been able to locate much on this using good ol' Google. Does
> it sound like a good design? Anyone got any experiences on doing
> anything similar?
> 
> /niklas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Expose-OSGi-service-as-a-web-service-tp16764361p16834792.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org