Expand my Community achievements bar.

SOLVED

Calling an OSGi service from outside the AEM instance

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

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

Avatar

Level 2

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