Calling an OSGi service from outside the AEM instance | Community
Skip to main content
Level 2
October 16, 2015
Solved

Calling an OSGi service from outside the AEM instance

  • October 16, 2015
  • 2 replies
  • 1177 views

Hi,

Let's assume that I have create an OSGi Service in AEM and I have set its sling.servlet.paths property to '/bin/testservice'. Assuming that this service is active and the AEM instance is running, how do I call this service and obtain the service response from a Java snippet that is running on my local system(outside the AEM server)?

 

Thanks in advance

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

HI

use the HTTP client of your choice and call this URL? You might need to add proper authentication (ootb basic auth is working).

Jörg

2 replies

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

HI

use the HTTP client of your choice and call this URL? You might need to add proper authentication (ootb basic auth is working).

Jörg

Level 2
October 16, 2015

Jörg Hoh wrote...

HI

use the HTTP client of your choice and call this URL? You might need to add proper authentication (ootb basic auth is working).

Jörg

 

Hi Jörg,

The solution that you have mentioned worked out for me. I used the Apache HTTP Client and I connected to the CQ instance through the DefaultHttpClient. Then, using the URIBuilder, I created a URL that points to my service(with request parameters) and instantiated an HttpGet request with this URI. Then I consumed the response of the DefaultHttpClient with a ResponseHandler.


Thanks a ton for the quick response.
Shriram