Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8142583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:51:45+00:00 2026-06-06T12:51:45+00:00

I am new to OSGi. Whatever tutorials i read i am unable to find

  • 0

I am new to OSGi. Whatever tutorials i read i am unable to find how data is exchanged between a service and a bundle. I know that one bundle has to get registered itself with service registry so that other bundles can use them. However i am unable to get how the data between the service and bundle is exchanged. Like in web services the data is exchanged as XML format or like and using Http protocol. So how the data is exchanged between the service and the bundle using it. Is it also via some protocol or how? And also does it involves any overhead. Please Help

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:51:46+00:00Added an answer on June 6, 2026 at 12:51 pm

    No protocol is involved. You do standard Java method calls.

    How it works is basically like this:

    1. You define a Java interface for your service. Just a normal interface, nothing special has to be implemented. E.g.

      interface TimeService {
      public String getCurrentTime();
      }

    2. You implement the interface (in a separate package, which you don’t export from your bundle)

    3. You register this interface in the OSGi Service Registry:

      timeServReg = bc.registerService(TimeService.class.getName(),
      new TimeServiceSimple(),
      props);

    4. In the second bundle – the one that wants to use it, you search for this service:

      timeRef = bc.getServiceReference(TimeService.class.getName());
      if (timeRef != null) {
      timeService = (TimeService) bc.getService(timeRef);
      }

    5. You use the service by simply using the Java object you just got.
      You call the methods:

      System.out.println(“The current time is: ” + timeService.getCurrentTime());

    Of course there are many details and good practices, like for example to use the ServiceTracker for finding the service etc. but this is the basics.

    You can find many examples here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm tracking OSGi bundles like this: BundleTracker<Foo> bundleTracker = new BundleTracker<>(context, Bundle.ACTIVE, new BundleTrackerCustomizer<Foo>(){
I'm new whith OSGi, but it is interesting. Is it possible to interact between
Once an instance of an OSGi service is retrieved from the bundle context does
I have created an OSGi bundle with an exposed (declarative) service. If I, when
I created some OSGi-bundles. One of these has a function to export data to
I'm new to OSGI and working on such project that runs on websphere. I
I am pretty new to the whole Java and OSGi world and I have
i'm fairly new to osgi and am trying to get a functional proof of
I am new to OSGi and came across several examples about OSGi services. For
I created an OSGi project in which one I've 2 projects : - one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.