You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jo...@exceter.com on 2011/08/06 03:04:12 UTC

Embedding CXF

I'd like to embed CXF in a way similar to the way it could be done in  
XFire, http://xfire.codehaus.org/Embedding+XFire

I need to be able to programmatically register and unregister services  
and I need to be able to construct the service with an instance of my  
service class so that I can inject dependencies.

I don't want to use spring.

Is this possible?
-John


Re: Embedding CXF

Posted by Mahesh Koli <mc...@gmail.com>.
I am not sure if this might help you.

http://testablejava.blogspot.com/2011/07/testing-cxf-based-soap-webservice.html

What is mentioned there can be easily done without using spring



On Sat, Aug 6, 2011 at 9:29 AM, <jo...@exceter.com> wrote:

>
> I need to be able to unpublish the service without restarting the server.
>
>
> Quoting Willem Jiang <wi...@gmail.com>:
>
>  Yes, it is possible.
>>
>> You can using JaxWsServerFactoryBean to publish the service or stop the
>> server as you want.
>>
>> You can find more information here[1]
>>
>> [1]http://cxf.apache.org/docs/**a-simple-jax-ws-service.html<http://cxf.apache.org/docs/a-simple-jax-ws-service.html>
>>
>> On 8/6/11 9:04 AM, john.dunlap@exceter.com wrote:
>>
>>> I'd like to embed CXF in a way similar to the way it could be done in
>>> XFire, http://xfire.codehaus.org/**Embedding+XFire<http://xfire.codehaus.org/Embedding+XFire>
>>>
>>> I need to be able to programmatically register and unregister services
>>> and I need to be able to construct the service with an instance of my
>>> service class so that I can inject dependencies.
>>>
>>> I don't want to use spring.
>>>
>>> Is this possible?
>>> -John
>>>
>>>
>>>
>>
>> --
>> Willem
>> ------------------------------**----
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog:    http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(English)
>>         http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: willemjiang
>>
>
>
>
>

Re: Embedding CXF

Posted by jo...@exceter.com.
I think I'm going to have to dig through the CXF spring namespace  
handler to figure out if the functionality I'm looking for exists. I  
shouldn't need OSGI to unregister individual endpoints...

-John

Quoting Angelo zerr <an...@gmail.com>:

> Hi John,
>
> I suggets you to read http://cxf.apache.org/distributed-osgi.html
>
> Regards Angelo
>
>
> 2011/8/8 Angelo zerr <an...@gmail.com>
>
>> Hi John,
>>
>> I think this post
>> http://cxf.547215.n5.nabble.com/CXF-amp-Osgi-bundle-problem-td556037.htmlcould interest   
>> you.
>>
>> To publish/unpublish your webservice, I wll do modify the sample like this
>> :
>> -------------------------------------------------
>>
>> import javax.xml.ws.Endpoint;
>>
>> import org.*osgi*.framework.BundleActivator;
>> import org.*osgi*.framework.BundleContext;
>>
>> public class Activator implements BundleActivator {
>>
>>         private Endpoint endpoint;
>>         public void start(BundleContext arg0) throws Exception {
>>                 HelloWorldImpl hwi = new HelloWorldImpl();
>>                 endpoint = Endpoint.publish("
>> http://localhost:9000/HelloWorld", hwi);
>>         }
>>
>>         public void stop(BundleContext arg0) throws Exception {
>>            if (endpoint !=null) {
>>               endpoint.stop();
>>            }
>>         }
>> }
>> ---------------------
>>
>> I have never done that or tested that, it's just an idea.
>>
>> Regards Angelo
>>
>> 2011/8/7 <jo...@exceter.com>
>>
>>
>>> I'm operating in an OSGI execution environment and I need to be able to
>>> deploy and undeploy individual services without disrupting the other
>>> services.
>>>
>>> -John
>>>
>>>
>>> Quoting Willem Jiang <wi...@gmail.com>:
>>>
>>>  Not sure what's your meaning of server.
>>>> But I think the server which is create from JaxWsServerFactoryBean can
>>>> be start and stop with java code as you want.
>>>>
>>>> On 8/6/11 9:29 PM, john.dunlap@exceter.com wrote:
>>>>
>>>>>
>>>>> I need to be able to unpublish the service without restarting the
>>>>> server.
>>>>>
>>>>> Quoting Willem Jiang <wi...@gmail.com>:
>>>>>
>>>>>  Yes, it is possible.
>>>>>>
>>>>>> You can using JaxWsServerFactoryBean to publish the service or stop the
>>>>>> server as you want.
>>>>>>
>>>>>> You can find more information here[1]
>>>>>>
>>>>>> [1]http://cxf.apache.org/docs/**a-simple-jax-ws-service.html<http://cxf.apache.org/docs/a-simple-jax-ws-service.html>
>>>>>>
>>>>>> On 8/6/11 9:04 AM, john.dunlap@exceter.com wrote:
>>>>>>
>>>>>>> I'd like to embed CXF in a way similar to the way it could be done in
>>>>>>> XFire,   
>>>>>>> http://xfire.codehaus.org/**Embedding+XFire<http://xfire.codehaus.org/Embedding+XFire>
>>>>>>>
>>>>>>> I need to be able to programmatically register and unregister services
>>>>>>> and I need to be able to construct the service with an instance of my
>>>>>>> service class so that I can inject dependencies.
>>>>>>>
>>>>>>> I don't want to use spring.
>>>>>>>
>>>>>>> Is this possible?
>>>>>>> -John
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Willem
>>>>>> ------------------------------**----
>>>>>> FuseSource
>>>>>> Web: http://www.fusesource.com
>>>>>> Blog:   
>>>>>> http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(English)
>>>>>> http://jnn.javaeye.com (Chinese)
>>>>>> Twitter: willemjiang
>>>>>> Weibo: willemjiang
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Willem
>>>> ------------------------------**----
>>>> FuseSource
>>>> Web: http://www.fusesource.com
>>>> Blog:      
>>>> http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(English)
>>>>         http://jnn.javaeye.com (Chinese)
>>>> Twitter: willemjiang
>>>> Weibo: willemjiang
>>>>
>>>
>>>
>>>
>>>
>>
>




Re: Embedding CXF

Posted by Angelo zerr <an...@gmail.com>.
Hi John,

I suggets you to read http://cxf.apache.org/distributed-osgi.html

Regards Angelo


2011/8/8 Angelo zerr <an...@gmail.com>

> Hi John,
>
> I think this post
> http://cxf.547215.n5.nabble.com/CXF-amp-Osgi-bundle-problem-td556037.htmlcould interest you.
>
> To publish/unpublish your webservice, I wll do modify the sample like this
> :
> -------------------------------------------------
>
> import javax.xml.ws.Endpoint;
>
> import org.*osgi*.framework.BundleActivator;
> import org.*osgi*.framework.BundleContext;
>
> public class Activator implements BundleActivator {
>
>         private Endpoint endpoint;
>         public void start(BundleContext arg0) throws Exception {
>                 HelloWorldImpl hwi = new HelloWorldImpl();
>                 endpoint = Endpoint.publish("
> http://localhost:9000/HelloWorld", hwi);
>         }
>
>         public void stop(BundleContext arg0) throws Exception {
>            if (endpoint !=null) {
>               endpoint.stop();
>            }
>         }
> }
> ---------------------
>
> I have never done that or tested that, it's just an idea.
>
> Regards Angelo
>
> 2011/8/7 <jo...@exceter.com>
>
>
>> I'm operating in an OSGI execution environment and I need to be able to
>> deploy and undeploy individual services without disrupting the other
>> services.
>>
>> -John
>>
>>
>> Quoting Willem Jiang <wi...@gmail.com>:
>>
>>  Not sure what's your meaning of server.
>>> But I think the server which is create from JaxWsServerFactoryBean can
>>> be start and stop with java code as you want.
>>>
>>> On 8/6/11 9:29 PM, john.dunlap@exceter.com wrote:
>>>
>>>>
>>>> I need to be able to unpublish the service without restarting the
>>>> server.
>>>>
>>>> Quoting Willem Jiang <wi...@gmail.com>:
>>>>
>>>>  Yes, it is possible.
>>>>>
>>>>> You can using JaxWsServerFactoryBean to publish the service or stop the
>>>>> server as you want.
>>>>>
>>>>> You can find more information here[1]
>>>>>
>>>>> [1]http://cxf.apache.org/docs/**a-simple-jax-ws-service.html<http://cxf.apache.org/docs/a-simple-jax-ws-service.html>
>>>>>
>>>>> On 8/6/11 9:04 AM, john.dunlap@exceter.com wrote:
>>>>>
>>>>>> I'd like to embed CXF in a way similar to the way it could be done in
>>>>>> XFire, http://xfire.codehaus.org/**Embedding+XFire<http://xfire.codehaus.org/Embedding+XFire>
>>>>>>
>>>>>> I need to be able to programmatically register and unregister services
>>>>>> and I need to be able to construct the service with an instance of my
>>>>>> service class so that I can inject dependencies.
>>>>>>
>>>>>> I don't want to use spring.
>>>>>>
>>>>>> Is this possible?
>>>>>> -John
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Willem
>>>>> ------------------------------**----
>>>>> FuseSource
>>>>> Web: http://www.fusesource.com
>>>>> Blog: http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(English)
>>>>> http://jnn.javaeye.com (Chinese)
>>>>> Twitter: willemjiang
>>>>> Weibo: willemjiang
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> Willem
>>> ------------------------------**----
>>> FuseSource
>>> Web: http://www.fusesource.com
>>> Blog:    http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(English)
>>>         http://jnn.javaeye.com (Chinese)
>>> Twitter: willemjiang
>>> Weibo: willemjiang
>>>
>>
>>
>>
>>
>

Re: Embedding CXF

Posted by Angelo zerr <an...@gmail.com>.
Hi John,

I think this post
http://cxf.547215.n5.nabble.com/CXF-amp-Osgi-bundle-problem-td556037.htmlcould
interest you.

To publish/unpublish your webservice, I wll do modify the sample like this
:
-------------------------------------------------

import javax.xml.ws.Endpoint;

import org.*osgi*.framework.BundleActivator;
import org.*osgi*.framework.BundleContext;

public class Activator implements BundleActivator {

        private Endpoint endpoint;
        public void start(BundleContext arg0) throws Exception {
                HelloWorldImpl hwi = new HelloWorldImpl();
                endpoint = Endpoint.publish("
http://localhost:9000/HelloWorld", hwi);
        }

        public void stop(BundleContext arg0) throws Exception {
           if (endpoint !=null) {
              endpoint.stop();
           }
        }
}
---------------------

I have never done that or tested that, it's just an idea.

Regards Angelo

2011/8/7 <jo...@exceter.com>

>
> I'm operating in an OSGI execution environment and I need to be able to
> deploy and undeploy individual services without disrupting the other
> services.
>
> -John
>
>
> Quoting Willem Jiang <wi...@gmail.com>:
>
>  Not sure what's your meaning of server.
>> But I think the server which is create from JaxWsServerFactoryBean can
>> be start and stop with java code as you want.
>>
>> On 8/6/11 9:29 PM, john.dunlap@exceter.com wrote:
>>
>>>
>>> I need to be able to unpublish the service without restarting the server.
>>>
>>> Quoting Willem Jiang <wi...@gmail.com>:
>>>
>>>  Yes, it is possible.
>>>>
>>>> You can using JaxWsServerFactoryBean to publish the service or stop the
>>>> server as you want.
>>>>
>>>> You can find more information here[1]
>>>>
>>>> [1]http://cxf.apache.org/docs/**a-simple-jax-ws-service.html<http://cxf.apache.org/docs/a-simple-jax-ws-service.html>
>>>>
>>>> On 8/6/11 9:04 AM, john.dunlap@exceter.com wrote:
>>>>
>>>>> I'd like to embed CXF in a way similar to the way it could be done in
>>>>> XFire, http://xfire.codehaus.org/**Embedding+XFire<http://xfire.codehaus.org/Embedding+XFire>
>>>>>
>>>>> I need to be able to programmatically register and unregister services
>>>>> and I need to be able to construct the service with an instance of my
>>>>> service class so that I can inject dependencies.
>>>>>
>>>>> I don't want to use spring.
>>>>>
>>>>> Is this possible?
>>>>> -John
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Willem
>>>> ------------------------------**----
>>>> FuseSource
>>>> Web: http://www.fusesource.com
>>>> Blog: http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(English)
>>>> http://jnn.javaeye.com (Chinese)
>>>> Twitter: willemjiang
>>>> Weibo: willemjiang
>>>>
>>>
>>>
>>>
>>>
>>>
>>
>> --
>> Willem
>> ------------------------------**----
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog:    http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(English)
>>         http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: willemjiang
>>
>
>
>
>

Re: Embedding CXF

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

I think you can take a look at cxf-osgi example shipped with Apache  
Servicemix 4.3. With that example, when install the example bundle,  
the cxf service is started, when you uninstall the example bundle, the  
cxf service is down, which means you can deploy and undeploy  
individual services without disrupting the other services.

P.S.  Apache Servicemix 4.3 basically is an OSGi container which can  
support cxf/camel/activemq out-of-box.

Freeman
On 2011-8-8, at 上午2:30, john.dunlap@exceter.com wrote:

>
> I'm operating in an OSGI execution environment and I need to be able  
> to deploy and undeploy individual services without disrupting the  
> other services.
>
> -John
>
> Quoting Willem Jiang <wi...@gmail.com>:
>
>> Not sure what's your meaning of server.
>> But I think the server which is create from JaxWsServerFactoryBean  
>> can
>> be start and stop with java code as you want.
>>
>> On 8/6/11 9:29 PM, john.dunlap@exceter.com wrote:
>>>
>>> I need to be able to unpublish the service without restarting the  
>>> server.
>>>
>>> Quoting Willem Jiang <wi...@gmail.com>:
>>>
>>>> Yes, it is possible.
>>>>
>>>> You can using JaxWsServerFactoryBean to publish the service or  
>>>> stop the
>>>> server as you want.
>>>>
>>>> You can find more information here[1]
>>>>
>>>> [1]http://cxf.apache.org/docs/a-simple-jax-ws-service.html
>>>>
>>>> On 8/6/11 9:04 AM, john.dunlap@exceter.com wrote:
>>>>> I'd like to embed CXF in a way similar to the way it could be  
>>>>> done in
>>>>> XFire, http://xfire.codehaus.org/Embedding+XFire
>>>>>
>>>>> I need to be able to programmatically register and unregister  
>>>>> services
>>>>> and I need to be able to construct the service with an instance  
>>>>> of my
>>>>> service class so that I can inject dependencies.
>>>>>
>>>>> I don't want to use spring.
>>>>>
>>>>> Is this possible?
>>>>> -John
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Willem
>>>> ----------------------------------
>>>> FuseSource
>>>> Web: http://www.fusesource.com
>>>> Blog: http://willemjiang.blogspot.com (English)
>>>> http://jnn.javaeye.com (Chinese)
>>>> Twitter: willemjiang
>>>> Weibo: willemjiang
>>>
>>>
>>>
>>>
>>
>>
>> -- 
>> Willem
>> ----------------------------------
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog:    http://willemjiang.blogspot.com (English)
>>         http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: willemjiang
>
>
>

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










Re: Embedding CXF

Posted by jo...@exceter.com.
I'm operating in an OSGI execution environment and I need to be able  
to deploy and undeploy individual services without disrupting the  
other services.

-John

Quoting Willem Jiang <wi...@gmail.com>:

> Not sure what's your meaning of server.
> But I think the server which is create from JaxWsServerFactoryBean can
> be start and stop with java code as you want.
>
> On 8/6/11 9:29 PM, john.dunlap@exceter.com wrote:
>>
>> I need to be able to unpublish the service without restarting the server.
>>
>> Quoting Willem Jiang <wi...@gmail.com>:
>>
>>> Yes, it is possible.
>>>
>>> You can using JaxWsServerFactoryBean to publish the service or stop the
>>> server as you want.
>>>
>>> You can find more information here[1]
>>>
>>> [1]http://cxf.apache.org/docs/a-simple-jax-ws-service.html
>>>
>>> On 8/6/11 9:04 AM, john.dunlap@exceter.com wrote:
>>>> I'd like to embed CXF in a way similar to the way it could be done in
>>>> XFire, http://xfire.codehaus.org/Embedding+XFire
>>>>
>>>> I need to be able to programmatically register and unregister services
>>>> and I need to be able to construct the service with an instance of my
>>>> service class so that I can inject dependencies.
>>>>
>>>> I don't want to use spring.
>>>>
>>>> Is this possible?
>>>> -John
>>>>
>>>>
>>>
>>>
>>> --
>>> Willem
>>> ----------------------------------
>>> FuseSource
>>> Web: http://www.fusesource.com
>>> Blog: http://willemjiang.blogspot.com (English)
>>> http://jnn.javaeye.com (Chinese)
>>> Twitter: willemjiang
>>> Weibo: willemjiang
>>
>>
>>
>>
>
>
> -- 
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>          http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang




Re: Embedding CXF

Posted by Willem Jiang <wi...@gmail.com>.
Not sure what's your meaning of server.
But I think the server which is create from JaxWsServerFactoryBean can 
be start and stop with java code as you want.

On 8/6/11 9:29 PM, john.dunlap@exceter.com wrote:
>
> I need to be able to unpublish the service without restarting the server.
>
> Quoting Willem Jiang <wi...@gmail.com>:
>
>> Yes, it is possible.
>>
>> You can using JaxWsServerFactoryBean to publish the service or stop the
>> server as you want.
>>
>> You can find more information here[1]
>>
>> [1]http://cxf.apache.org/docs/a-simple-jax-ws-service.html
>>
>> On 8/6/11 9:04 AM, john.dunlap@exceter.com wrote:
>>> I'd like to embed CXF in a way similar to the way it could be done in
>>> XFire, http://xfire.codehaus.org/Embedding+XFire
>>>
>>> I need to be able to programmatically register and unregister services
>>> and I need to be able to construct the service with an instance of my
>>> service class so that I can inject dependencies.
>>>
>>> I don't want to use spring.
>>>
>>> Is this possible?
>>> -John
>>>
>>>
>>
>>
>> --
>> Willem
>> ----------------------------------
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog: http://willemjiang.blogspot.com (English)
>> http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: willemjiang
>
>
>
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: Embedding CXF

Posted by jo...@exceter.com.
I need to be able to unpublish the service without restarting the server.

Quoting Willem Jiang <wi...@gmail.com>:

> Yes, it is possible.
>
> You can using JaxWsServerFactoryBean to publish the service or stop the
> server as you want.
>
> You can find more information here[1]
>
> [1]http://cxf.apache.org/docs/a-simple-jax-ws-service.html
>
> On 8/6/11 9:04 AM, john.dunlap@exceter.com wrote:
>> I'd like to embed CXF in a way similar to the way it could be done in
>> XFire, http://xfire.codehaus.org/Embedding+XFire
>>
>> I need to be able to programmatically register and unregister services
>> and I need to be able to construct the service with an instance of my
>> service class so that I can inject dependencies.
>>
>> I don't want to use spring.
>>
>> Is this possible?
>> -John
>>
>>
>
>
> -- 
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>          http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang




Re: Embedding CXF

Posted by Willem Jiang <wi...@gmail.com>.
Yes, it is possible.

You can using JaxWsServerFactoryBean to publish the service or stop the 
server as you want.

You can find more information here[1]

[1]http://cxf.apache.org/docs/a-simple-jax-ws-service.html

On 8/6/11 9:04 AM, john.dunlap@exceter.com wrote:
> I'd like to embed CXF in a way similar to the way it could be done in
> XFire, http://xfire.codehaus.org/Embedding+XFire
>
> I need to be able to programmatically register and unregister services
> and I need to be able to construct the service with an instance of my
> service class so that I can inject dependencies.
>
> I don't want to use spring.
>
> Is this possible?
> -John
>
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang