You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Alexey Zavizionov <al...@gmail.com> on 2008/09/18 13:46:22 UTC

Moving service from XFire to CXF

Hello list,

I have read a migration article at
http://cwiki.apache.org/CXF20DOC/xfire-migration-guide.html

Where I could find a cxf equivalent to register service:
XFireFactory.newInstance().getXFire().getServiceRegistry().register(myService);

Alexey.

Re: Moving service from XFire to CXF

Posted by Alexey Zavizionov <al...@gmail.com>.
Thank you!

On Thu, Sep 18, 2008 at 4:56 PM, Benson Margulies <bi...@gmail.com>wrote:

> Yes, that's fine. CXF doesn't have a 'service registry', you did
> everything you have to do.
>
> On Thu, Sep 18, 2008 at 9:37 AM, Alexey Zavizionov
> <al...@gmail.com> wrote:
> > I have read a simple JAX-WS service article at [1] and found same factory
> > bean (JaxWsServerFactoryBean) for creating a JAX-WS server endpoint from
> a
> > class as in the migration guide at [2].
> >
> > I have annotated simple service interface:
> > ===================================
> > @WebService(name = "TicketOrderService",
> >            serviceName = "TicketOrderService",
> >            targetNamespace = "http://exoplatform.org/soap/xfire")
> > public interface TicketOrderService {...
> >  public String getTicket (...
> > ===================================
> > and my service simple implementation TicketOrderServiceImpl, which
> returns a
> > string representation of current time.
> >
> > And here my cxf test:
> > ===================================
> >        JaxWsServerFactoryBean serviceFactory = new
> > JaxWsServerFactoryBean();
> >        serviceFactory.getServiceFactory().setDataBinding(new
> > AegisDatabinding());
> >        serviceFactory.setServiceClass(TicketOrderService.class);
> >        serviceFactory.setAddress("local://TicketOrderService");
> >        Server server = serviceFactory.create();
> >
> >        Service service = server.getEndpoint().getService();
> >        service.setInvoker(new BeanInvoker(new TicketOrderServiceImpl()));
> >
> >        server.start();
> >
> >        JaxWsProxyFactoryBean client = new JaxWsProxyFactoryBean();
> >        client.setServiceClass(TicketOrderService.class);
> >        client.setAddress("local://TicketOrderService");
> >        TicketOrderService ticket = (TicketOrderService) client.create();
> >
> >        String ticketOrder = ticket.getTicket("1", "2", null, "3");
> >        System.out.println(">>> EXOMAN
> > TicketOrderServiceTest.testSayHelloService() ticketOrder = "
> >            + ticketOrder);
> >        assertNotNull(ticketOrder);
> > ===================================
> >
> > was an xfire test:
> > ===================================
> >        XFire xfire = XFireFactory.newInstance().getXFire();
> >        assertNotNull(xfire);
> >        AnnotationServiceFactory annotationServiceFactory = new
> > AnnotationServiceFactory();
> >        Service ws =
> > annotationServiceFactory.create(TicketOrderService.getClass());
> >        xfire.getServiceRegistry().register(ws);
> >
> > assertTrue(xfire.getServiceRegistry().hasService("TicketOrderService"));
> > ===================================
> >
> > It works. But whether all that I did was right?
> >
> > [1]
> >
> http://cwiki.apache.org/CXF20DOC/a-simple-jax-ws-service.html#AsimpleJAX-WSservice-Publishingyourservice
> > [2]
> >
> http://cwiki.apache.org/CXF20DOC/xfire-migration-guide.html#XFireMigrationGuide-ExampleAnnotationServiceFactoryMigration
> >
> > On Thu, Sep 18, 2008 at 3:32 PM, Benson Margulies <bimargulies@gmail.com
> >wrote:
> >
> >> You use the service factory bean to obtain a service, and you 'start'
> >> it. No need to register it.
> >>
> >> Are you moving to JAX-WS or using 'simple'? I can probably point you
> >> at an example either way.
> >>
> >> On Thu, Sep 18, 2008 at 8:10 AM, Alexey Zavizionov
> >> <al...@gmail.com> wrote:
> >> > Thanks for the reply.
> >> >
> >> > Setting up all from java. I should not use Spring.
> >> >
> >> > On Thu, Sep 18, 2008 at 2:58 PM, Benson Margulies <
> bimargulies@gmail.com
> >> >wrote:
> >> >
> >> >> The closest equivalent, so far as I know, is publishing an endpoint.
> >> >> Have you moved to Spring config, or are you setting everything up
> from
> >> >> Java?
> >> >>
> >> >> On Thu, Sep 18, 2008 at 7:46 AM, Alexey Zavizionov
> >> >> <al...@gmail.com> wrote:
> >> >> > Hello list,
> >> >> >
> >> >> > I have read a migration article at
> >> >> > http://cwiki.apache.org/CXF20DOC/xfire-migration-guide.html
> >> >> >
> >> >> > Where I could find a cxf equivalent to register service:
> >> >> >
> >> >>
> >>
> XFireFactory.newInstance().getXFire().getServiceRegistry().register(myService);
> >> >> >
> >> >> > Alexey.
> >> >> >
> >> >>
> >> >
> >>
> >
>

Re: Moving service from XFire to CXF

Posted by Benson Margulies <bi...@gmail.com>.
Yes, that's fine. CXF doesn't have a 'service registry', you did
everything you have to do.

On Thu, Sep 18, 2008 at 9:37 AM, Alexey Zavizionov
<al...@gmail.com> wrote:
> I have read a simple JAX-WS service article at [1] and found same factory
> bean (JaxWsServerFactoryBean) for creating a JAX-WS server endpoint from a
> class as in the migration guide at [2].
>
> I have annotated simple service interface:
> ===================================
> @WebService(name = "TicketOrderService",
>            serviceName = "TicketOrderService",
>            targetNamespace = "http://exoplatform.org/soap/xfire")
> public interface TicketOrderService {...
>  public String getTicket (...
> ===================================
> and my service simple implementation TicketOrderServiceImpl, which returns a
> string representation of current time.
>
> And here my cxf test:
> ===================================
>        JaxWsServerFactoryBean serviceFactory = new
> JaxWsServerFactoryBean();
>        serviceFactory.getServiceFactory().setDataBinding(new
> AegisDatabinding());
>        serviceFactory.setServiceClass(TicketOrderService.class);
>        serviceFactory.setAddress("local://TicketOrderService");
>        Server server = serviceFactory.create();
>
>        Service service = server.getEndpoint().getService();
>        service.setInvoker(new BeanInvoker(new TicketOrderServiceImpl()));
>
>        server.start();
>
>        JaxWsProxyFactoryBean client = new JaxWsProxyFactoryBean();
>        client.setServiceClass(TicketOrderService.class);
>        client.setAddress("local://TicketOrderService");
>        TicketOrderService ticket = (TicketOrderService) client.create();
>
>        String ticketOrder = ticket.getTicket("1", "2", null, "3");
>        System.out.println(">>> EXOMAN
> TicketOrderServiceTest.testSayHelloService() ticketOrder = "
>            + ticketOrder);
>        assertNotNull(ticketOrder);
> ===================================
>
> was an xfire test:
> ===================================
>        XFire xfire = XFireFactory.newInstance().getXFire();
>        assertNotNull(xfire);
>        AnnotationServiceFactory annotationServiceFactory = new
> AnnotationServiceFactory();
>        Service ws =
> annotationServiceFactory.create(TicketOrderService.getClass());
>        xfire.getServiceRegistry().register(ws);
>
> assertTrue(xfire.getServiceRegistry().hasService("TicketOrderService"));
> ===================================
>
> It works. But whether all that I did was right?
>
> [1]
> http://cwiki.apache.org/CXF20DOC/a-simple-jax-ws-service.html#AsimpleJAX-WSservice-Publishingyourservice
> [2]
> http://cwiki.apache.org/CXF20DOC/xfire-migration-guide.html#XFireMigrationGuide-ExampleAnnotationServiceFactoryMigration
>
> On Thu, Sep 18, 2008 at 3:32 PM, Benson Margulies <bi...@gmail.com>wrote:
>
>> You use the service factory bean to obtain a service, and you 'start'
>> it. No need to register it.
>>
>> Are you moving to JAX-WS or using 'simple'? I can probably point you
>> at an example either way.
>>
>> On Thu, Sep 18, 2008 at 8:10 AM, Alexey Zavizionov
>> <al...@gmail.com> wrote:
>> > Thanks for the reply.
>> >
>> > Setting up all from java. I should not use Spring.
>> >
>> > On Thu, Sep 18, 2008 at 2:58 PM, Benson Margulies <bimargulies@gmail.com
>> >wrote:
>> >
>> >> The closest equivalent, so far as I know, is publishing an endpoint.
>> >> Have you moved to Spring config, or are you setting everything up from
>> >> Java?
>> >>
>> >> On Thu, Sep 18, 2008 at 7:46 AM, Alexey Zavizionov
>> >> <al...@gmail.com> wrote:
>> >> > Hello list,
>> >> >
>> >> > I have read a migration article at
>> >> > http://cwiki.apache.org/CXF20DOC/xfire-migration-guide.html
>> >> >
>> >> > Where I could find a cxf equivalent to register service:
>> >> >
>> >>
>> XFireFactory.newInstance().getXFire().getServiceRegistry().register(myService);
>> >> >
>> >> > Alexey.
>> >> >
>> >>
>> >
>>
>

Re: Moving service from XFire to CXF

Posted by Alexey Zavizionov <al...@gmail.com>.
I have read a simple JAX-WS service article at [1] and found same factory
bean (JaxWsServerFactoryBean) for creating a JAX-WS server endpoint from a
class as in the migration guide at [2].

I have annotated simple service interface:
===================================
@WebService(name = "TicketOrderService",
            serviceName = "TicketOrderService",
            targetNamespace = "http://exoplatform.org/soap/xfire")
public interface TicketOrderService {...
  public String getTicket (...
===================================
and my service simple implementation TicketOrderServiceImpl, which returns a
string representation of current time.

And here my cxf test:
===================================
        JaxWsServerFactoryBean serviceFactory = new
JaxWsServerFactoryBean();
        serviceFactory.getServiceFactory().setDataBinding(new
AegisDatabinding());
        serviceFactory.setServiceClass(TicketOrderService.class);
        serviceFactory.setAddress("local://TicketOrderService");
        Server server = serviceFactory.create();

        Service service = server.getEndpoint().getService();
        service.setInvoker(new BeanInvoker(new TicketOrderServiceImpl()));

        server.start();

        JaxWsProxyFactoryBean client = new JaxWsProxyFactoryBean();
        client.setServiceClass(TicketOrderService.class);
        client.setAddress("local://TicketOrderService");
        TicketOrderService ticket = (TicketOrderService) client.create();

        String ticketOrder = ticket.getTicket("1", "2", null, "3");
        System.out.println(">>> EXOMAN
TicketOrderServiceTest.testSayHelloService() ticketOrder = "
            + ticketOrder);
        assertNotNull(ticketOrder);
===================================

was an xfire test:
===================================
        XFire xfire = XFireFactory.newInstance().getXFire();
        assertNotNull(xfire);
        AnnotationServiceFactory annotationServiceFactory = new
AnnotationServiceFactory();
        Service ws =
annotationServiceFactory.create(TicketOrderService.getClass());
        xfire.getServiceRegistry().register(ws);

assertTrue(xfire.getServiceRegistry().hasService("TicketOrderService"));
===================================

It works. But whether all that I did was right?

[1]
http://cwiki.apache.org/CXF20DOC/a-simple-jax-ws-service.html#AsimpleJAX-WSservice-Publishingyourservice
[2]
http://cwiki.apache.org/CXF20DOC/xfire-migration-guide.html#XFireMigrationGuide-ExampleAnnotationServiceFactoryMigration

On Thu, Sep 18, 2008 at 3:32 PM, Benson Margulies <bi...@gmail.com>wrote:

> You use the service factory bean to obtain a service, and you 'start'
> it. No need to register it.
>
> Are you moving to JAX-WS or using 'simple'? I can probably point you
> at an example either way.
>
> On Thu, Sep 18, 2008 at 8:10 AM, Alexey Zavizionov
> <al...@gmail.com> wrote:
> > Thanks for the reply.
> >
> > Setting up all from java. I should not use Spring.
> >
> > On Thu, Sep 18, 2008 at 2:58 PM, Benson Margulies <bimargulies@gmail.com
> >wrote:
> >
> >> The closest equivalent, so far as I know, is publishing an endpoint.
> >> Have you moved to Spring config, or are you setting everything up from
> >> Java?
> >>
> >> On Thu, Sep 18, 2008 at 7:46 AM, Alexey Zavizionov
> >> <al...@gmail.com> wrote:
> >> > Hello list,
> >> >
> >> > I have read a migration article at
> >> > http://cwiki.apache.org/CXF20DOC/xfire-migration-guide.html
> >> >
> >> > Where I could find a cxf equivalent to register service:
> >> >
> >>
> XFireFactory.newInstance().getXFire().getServiceRegistry().register(myService);
> >> >
> >> > Alexey.
> >> >
> >>
> >
>

Re: Moving service from XFire to CXF

Posted by Benson Margulies <bi...@gmail.com>.
You use the service factory bean to obtain a service, and you 'start'
it. No need to register it.

Are you moving to JAX-WS or using 'simple'? I can probably point you
at an example either way.

On Thu, Sep 18, 2008 at 8:10 AM, Alexey Zavizionov
<al...@gmail.com> wrote:
> Thanks for the reply.
>
> Setting up all from java. I should not use Spring.
>
> On Thu, Sep 18, 2008 at 2:58 PM, Benson Margulies <bi...@gmail.com>wrote:
>
>> The closest equivalent, so far as I know, is publishing an endpoint.
>> Have you moved to Spring config, or are you setting everything up from
>> Java?
>>
>> On Thu, Sep 18, 2008 at 7:46 AM, Alexey Zavizionov
>> <al...@gmail.com> wrote:
>> > Hello list,
>> >
>> > I have read a migration article at
>> > http://cwiki.apache.org/CXF20DOC/xfire-migration-guide.html
>> >
>> > Where I could find a cxf equivalent to register service:
>> >
>> XFireFactory.newInstance().getXFire().getServiceRegistry().register(myService);
>> >
>> > Alexey.
>> >
>>
>

Re: Moving service from XFire to CXF

Posted by Alexey Zavizionov <al...@gmail.com>.
Thanks for the reply.

Setting up all from java. I should not use Spring.

On Thu, Sep 18, 2008 at 2:58 PM, Benson Margulies <bi...@gmail.com>wrote:

> The closest equivalent, so far as I know, is publishing an endpoint.
> Have you moved to Spring config, or are you setting everything up from
> Java?
>
> On Thu, Sep 18, 2008 at 7:46 AM, Alexey Zavizionov
> <al...@gmail.com> wrote:
> > Hello list,
> >
> > I have read a migration article at
> > http://cwiki.apache.org/CXF20DOC/xfire-migration-guide.html
> >
> > Where I could find a cxf equivalent to register service:
> >
> XFireFactory.newInstance().getXFire().getServiceRegistry().register(myService);
> >
> > Alexey.
> >
>

Re: Moving service from XFire to CXF

Posted by Benson Margulies <bi...@gmail.com>.
The closest equivalent, so far as I know, is publishing an endpoint.
Have you moved to Spring config, or are you setting everything up from
Java?

On Thu, Sep 18, 2008 at 7:46 AM, Alexey Zavizionov
<al...@gmail.com> wrote:
> Hello list,
>
> I have read a migration article at
> http://cwiki.apache.org/CXF20DOC/xfire-migration-guide.html
>
> Where I could find a cxf equivalent to register service:
> XFireFactory.newInstance().getXFire().getServiceRegistry().register(myService);
>
> Alexey.
>