AFAIK you can't use OSGi declarative services from inside webapps or any
deployent artifacts. Declarative services are only for other OSGi bundles.
Its true that you can instantiate the service class and use it, or use
PriviledgedCarbonContext.getOSGiService(), but they are not the same as
using declarative services. If your service bundle leaves the OSGi
environment then you are left with a stale reference. It is not true
dynamic linking.

AFAIK there is no alternative for this currently so you have to use one of
the two above approaches. Its still good to expose it as a OSGi service for
future usage of it.

Thanks,
Johann.

On Sun, Oct 19, 2014 at 9:44 PM, Harshan Liyanage <hars...@wso2.com> wrote:

> Hi Inosh,
>
> As per the offline discussion with InoshP, I've modified the web app libs.
> Now I'm able to access the logic implemented in OSGi bundles.
>
> Thanks,
>
> Best Regards,
>
> Lakshitha Harshan
> Software Engineer
> Mobile: *+94724423048*
> Email: hars...@wso2.com
> Blog : http://harshanliyanage.blogspot.com/
> *WSO2, Inc. :** wso2.com <http://wso2.com/>*
> lean.enterprise.middleware.
>
> On Mon, Oct 20, 2014 at 8:50 AM, Inosh Perera <ino...@wso2.com> wrote:
>
>> Hi Harshan,
>> Yes, you can use Apache CXF for this purpose. You can find a simpler
>> example here[1] with sample code.
>>
>> [1] .
>> http://wso2.com/library/articles/2012/10/develop-cxf-based-jaxws-wso2-developer-studio/
>>
>> Regards,
>> Inosh
>>
>> On Sun, Oct 19, 2014 at 5:07 PM, Dilan Udara Ariyaratne <dil...@wso2.com>
>> wrote:
>>
>>> Hi Harshan!
>>>
>>> Apart from Apache CXF, Jersey is also a very good alternative that you
>>> can consider in writing your JAX-RS web applications.
>>>
>>> I am personally impressed with the simplicity of getting up-and-running
>>> Restful web services using Jersey.
>>>
>>> Resources that you may find useful on this:
>>> [1]
>>> http://stackoverflow.com/questions/2704700/java-rest-implementation-jersey-vs-cxf
>>> [2] https://jersey.java.net/documentation/latest/getting-started.html
>>> [2] http://www.vogella.com/tutorials/REST/article.html
>>>
>>> Cheers!
>>>
>>>
>>> *Dilan U. Ariyaratne*
>>> Software Engineer
>>> WSO2 Inc. <http://wso2.com/>
>>> Mobile: +94775149066
>>> lean . enterprise . middleware
>>>
>>> On Sun, Oct 19, 2014 at 12:09 PM, Bhathiya Jayasekara <bhath...@wso2.com
>>> > wrote:
>>>
>>>> Hi Harshan,
>>>>
>>>> On Sun, Oct 19, 2014 at 11:37 AM, Harshan Liyanage <hars...@wso2.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I'm trying to do the following.
>>>>>
>>>>>    1. Create a JAX-RS web app & deploy it in AS
>>>>>    2. Create an OSGi bundle which has all the business logic
>>>>>    implementation (exposed as OSGi services) for above JAX-RS web services
>>>>>    3. Consume above OSGi services inside JAX-RS web app
>>>>>
>>>>> What is the best way to achieve the above? Do I need to use Apache CXF
>>>>> for this?
>>>>>
>>>>
>>>> Yes, you can use CXF to write the REST service. We have used it in
>>>> several places[1][2][3] in platform. You can have look and learn how it is
>>>> used.
>>>>
>>>> [1]
>>>> https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/identity/org.wso2.carbon.identity.oauth.endpoint/4.2.3
>>>> [2]
>>>> https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/data-bridge/org.wso2.carbon.databridge.receiver.restapi/4.2.0
>>>> [3]
>>>> https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/identity/org.wso2.carbon.identity.scim.provider/4.2.1
>>>>
>>>> Thanks,
>>>> Bhathiya
>>>>
>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Best Regards,
>>>>>
>>>>> Lakshitha Harshan
>>>>> Software Engineer
>>>>> Mobile: *+94724423048*
>>>>> Email: hars...@wso2.com
>>>>> Blog : http://harshanliyanage.blogspot.com/
>>>>> *WSO2, Inc. :** wso2.com <http://wso2.com/>*
>>>>> lean.enterprise.middleware.
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> *Bhathiya Jayasekara*
>>>> *Software Engineer,*
>>>> *WSO2 inc., http://wso2.com <http://wso2.com>*
>>>>
>>>> *Phone: +94715478185 <%2B94715478185>*
>>>> *LinkedIn: http://www.linkedin.com/in/bhathiyaj
>>>> <http://www.linkedin.com/in/bhathiyaj>*
>>>> *Twitter: https://twitter.com/bhathiyax <https://twitter.com/bhathiyax>*
>>>> *Blog: http://movingaheadblog.blogspot.com
>>>> <http://movingaheadblog.blogspot.com/>*
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Inosh Perera
>> Software Engineer, WSO2 Inc.
>> Tel: 0785293686
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Thanks & Regards,

*Johann Dilantha Nallathamby*
Associate Technical Lead & Product Lead of WSO2 Identity Server
Integration Technologies Team
WSO2, Inc.
lean.enterprise.middleware

Mobile - *+94777776950*
Blog - *http://nallaa.wordpress.com <http://nallaa.wordpress.com>*
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to