You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Julien Charon <Ju...@avitech.aero> on 2015/06/22 09:21:36 UTC

Parametrised webservice

  Hi everybody,


I've implemented a webservice that acts as some kind of dispatcher, forwarding the received SOAP message body content to some legacy services.
What I'd like to do is to create multiple instances of that service and make those accessible under an own address each. My idea was to pass the name of the legacy service as a parameter to the service instance at creation time so that it can use the service name to dispatch the messages to the correct service.
What I tried to do is:

...
JaxWsServerFactoryBean srvBean = new JaxWsServerFactoryBean();
srvBean.setBus(getBus());
srvBean.setAddress("/legacyService1");
srvBean.setServiceBean(new SoapDispatcherServiceImpl("legacyService1"));
srvBean.create();

srvBean.setAddress("/legacyService2");
srvBean.setServiceBean(new SoapDispatcherServiceImpl("legacyService2"));
srvBean.create();

srvBean.setAddress("/legacyService3");
srvBean.setServiceBean(new SoapDispatcherServiceImpl("legacyService3"));
srvBean.create();
...

But this doesn't work the way I want it. The different addresses are accessible, but it looks like it's always the same service instance that processes the messages.

Am I doing something wrong? And is what I want to do generally possible?


Mit freundlichen Grüßen / With kind regards,
Julien Charon

Avitech GmbH
Engineering AxL
Tel.: +49 (0)7541/282-177
Fax: +49 (0)7541/282-199
e-mail: julien.charon@avitech.aero<ma...@avitech.aero>
________________________________________________
Avitech GmbH
Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany
Court Registration: Amtsgericht Ulm | HRB 728293
Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza
http://avitech.aero<http://avitech.aero/>

This message may contain confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.


AW: Parametrised webservice

Posted by Julien Charon <Ju...@avitech.aero>.
It indeed worked by creating a factory bean for each service, so according to my example:

 JaxWsServerFactoryBean srvBean = new JaxWsServerFactoryBean(); 
 srvBean.setBus(getBus()); 
 srvBean.setAddress("/legacyService1");
 srvBean.setServiceBean(new SoapDispatcherServiceImpl("legacyService1"));
 srvBean.create();
 
 srvBean = new JaxWsServerFactoryBean();
 srvBean.setBus(getBus());
 srvBean.setAddress("/legacyService2");
 srvBean.setServiceBean(new SoapDispatcherServiceImpl("legacyService2"));
 srvBean.create();

 srvBean = new JaxWsServerFactoryBean();
 srvBean.setBus(getBus()); 
 srvBean.setAddress("/legacyService3");
 srvBean.setServiceBean(new SoapDispatcherServiceImpl("legacyService3"));
 srvBean.create();



Mit freundlichen Grüßen / With kind regards,
 
Julien Charon

Avitech GmbH
Engineering AxL
Tel.: +49 (0)7541/282-177
Fax: +49 (0)7541/282-199
e-mail: julien.charon@avitech.aero
________________________________________________
Avitech GmbH
Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany
Court Registration: Amtsgericht Ulm | HRB 728293
Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza
http://avitech.aero

This message may contain confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.

-----Ursprüngliche Nachricht-----
Von: Julien Charon [mailto:Julien.Charon@avitech.aero] 
Gesendet: Montag, 22. Juni 2015 17:34
An: users@cxf.apache.org
Betreff: AW: Parametrised webservice

  Hi Dan,


I'm using CXF 2.7.16 and I can't use 3.1.1 because I'm limited to java 6 at the moment. I'll try with a JaxWsServerFactoryBean for each service, thanks for the suggestion.


Mit freundlichen Grüßen / With kind regards,
 
Julien Charon

Avitech GmbH
Engineering AxL
Tel.: +49 (0)7541/282-177
Fax: +49 (0)7541/282-199
e-mail: julien.charon@avitech.aero
________________________________________________
Avitech GmbH
Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany Court Registration: Amtsgericht Ulm | HRB 728293 Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza http://avitech.aero

This message may contain confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.

-----Ursprüngliche Nachricht-----
Von: Daniel Kulp [mailto:dkulp@apache.org]
Gesendet: Montag, 22. Juni 2015 17:29
An: users@cxf.apache.org
Betreff: Re: Parametrised webservice

What version of CXF?   Can you try with 3.1.1?

In version of CXF < 3.1, the JaxWsServerFactoryBean was intended to only be used "once".   It stored a lot of state that would be re-used if create is called a second time.   Thus, if you're using <3.1, I would suggest creating a new JaxWsServerFactoryBean for each of the 3 services. 

Dan



> On Jun 22, 2015, at 3:21 AM, Julien Charon <Ju...@avitech.aero> wrote:
> 
>  Hi everybody,
> 
> 
> I've implemented a webservice that acts as some kind of dispatcher, forwarding the received SOAP message body content to some legacy services.
> What I'd like to do is to create multiple instances of that service and make those accessible under an own address each. My idea was to pass the name of the legacy service as a parameter to the service instance at creation time so that it can use the service name to dispatch the messages to the correct service.
> What I tried to do is:
> 
> ...
> JaxWsServerFactoryBean srvBean = new JaxWsServerFactoryBean(); 
> srvBean.setBus(getBus()); srvBean.setAddress("/legacyService1");
> srvBean.setServiceBean(new
> SoapDispatcherServiceImpl("legacyService1"));
> srvBean.create();
> 
> srvBean.setAddress("/legacyService2");
> srvBean.setServiceBean(new
> SoapDispatcherServiceImpl("legacyService2"));
> srvBean.create();
> 
> srvBean.setAddress("/legacyService3");
> srvBean.setServiceBean(new
> SoapDispatcherServiceImpl("legacyService3"));
> srvBean.create();
> ...
> 
> But this doesn't work the way I want it. The different addresses are accessible, but it looks like it's always the same service instance that processes the messages.
> 
> Am I doing something wrong? And is what I want to do generally possible?
> 
> 
> Mit freundlichen Grüßen / With kind regards, Julien Charon
> 
> Avitech GmbH
> Engineering AxL
> Tel.: +49 (0)7541/282-177
> Fax: +49 (0)7541/282-199
> e-mail: julien.charon@avitech.aero<ma...@avitech.aero>
> ________________________________________________
> Avitech GmbH
> Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany 
> Court Registration: Amtsgericht Ulm | HRB 728293 
> Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza 
> http://avitech.aero<http://avitech.aero/>
> 
> This message may contain confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.
> 

--
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com


AW: Parametrised webservice

Posted by Julien Charon <Ju...@avitech.aero>.
  Hi Dan,


I'm using CXF 2.7.16 and I can't use 3.1.1 because I'm limited to java 6 at the moment. I'll try with a JaxWsServerFactoryBean for each service, thanks for the suggestion.


Mit freundlichen Grüßen / With kind regards,
 
Julien Charon

Avitech GmbH
Engineering AxL
Tel.: +49 (0)7541/282-177
Fax: +49 (0)7541/282-199
e-mail: julien.charon@avitech.aero
________________________________________________
Avitech GmbH
Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany
Court Registration: Amtsgericht Ulm | HRB 728293
Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza
http://avitech.aero

This message may contain confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.

-----Ursprüngliche Nachricht-----
Von: Daniel Kulp [mailto:dkulp@apache.org] 
Gesendet: Montag, 22. Juni 2015 17:29
An: users@cxf.apache.org
Betreff: Re: Parametrised webservice

What version of CXF?   Can you try with 3.1.1?

In version of CXF < 3.1, the JaxWsServerFactoryBean was intended to only be used "once".   It stored a lot of state that would be re-used if create is called a second time.   Thus, if you're using <3.1, I would suggest creating a new JaxWsServerFactoryBean for each of the 3 services. 

Dan



> On Jun 22, 2015, at 3:21 AM, Julien Charon <Ju...@avitech.aero> wrote:
> 
>  Hi everybody,
> 
> 
> I've implemented a webservice that acts as some kind of dispatcher, forwarding the received SOAP message body content to some legacy services.
> What I'd like to do is to create multiple instances of that service and make those accessible under an own address each. My idea was to pass the name of the legacy service as a parameter to the service instance at creation time so that it can use the service name to dispatch the messages to the correct service.
> What I tried to do is:
> 
> ...
> JaxWsServerFactoryBean srvBean = new JaxWsServerFactoryBean(); 
> srvBean.setBus(getBus()); srvBean.setAddress("/legacyService1");
> srvBean.setServiceBean(new 
> SoapDispatcherServiceImpl("legacyService1"));
> srvBean.create();
> 
> srvBean.setAddress("/legacyService2");
> srvBean.setServiceBean(new 
> SoapDispatcherServiceImpl("legacyService2"));
> srvBean.create();
> 
> srvBean.setAddress("/legacyService3");
> srvBean.setServiceBean(new 
> SoapDispatcherServiceImpl("legacyService3"));
> srvBean.create();
> ...
> 
> But this doesn't work the way I want it. The different addresses are accessible, but it looks like it's always the same service instance that processes the messages.
> 
> Am I doing something wrong? And is what I want to do generally possible?
> 
> 
> Mit freundlichen Grüßen / With kind regards, Julien Charon
> 
> Avitech GmbH
> Engineering AxL
> Tel.: +49 (0)7541/282-177
> Fax: +49 (0)7541/282-199
> e-mail: julien.charon@avitech.aero<ma...@avitech.aero>
> ________________________________________________
> Avitech GmbH
> Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany 
> Court Registration: Amtsgericht Ulm | HRB 728293 
> Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza 
> http://avitech.aero<http://avitech.aero/>
> 
> This message may contain confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.
> 

--
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com


Re: Parametrised webservice

Posted by Daniel Kulp <dk...@apache.org>.
What version of CXF?   Can you try with 3.1.1?

In version of CXF < 3.1, the JaxWsServerFactoryBean was intended to only be used “once”.   It stored a lot of state that would be re-used if create is called a second time.   Thus, if you’re using <3.1, I would suggest creating a new JaxWsServerFactoryBean for each of the 3 services. 

Dan



> On Jun 22, 2015, at 3:21 AM, Julien Charon <Ju...@avitech.aero> wrote:
> 
>  Hi everybody,
> 
> 
> I've implemented a webservice that acts as some kind of dispatcher, forwarding the received SOAP message body content to some legacy services.
> What I'd like to do is to create multiple instances of that service and make those accessible under an own address each. My idea was to pass the name of the legacy service as a parameter to the service instance at creation time so that it can use the service name to dispatch the messages to the correct service.
> What I tried to do is:
> 
> ...
> JaxWsServerFactoryBean srvBean = new JaxWsServerFactoryBean();
> srvBean.setBus(getBus());
> srvBean.setAddress("/legacyService1");
> srvBean.setServiceBean(new SoapDispatcherServiceImpl("legacyService1"));
> srvBean.create();
> 
> srvBean.setAddress("/legacyService2");
> srvBean.setServiceBean(new SoapDispatcherServiceImpl("legacyService2"));
> srvBean.create();
> 
> srvBean.setAddress("/legacyService3");
> srvBean.setServiceBean(new SoapDispatcherServiceImpl("legacyService3"));
> srvBean.create();
> ...
> 
> But this doesn't work the way I want it. The different addresses are accessible, but it looks like it's always the same service instance that processes the messages.
> 
> Am I doing something wrong? And is what I want to do generally possible?
> 
> 
> Mit freundlichen Grüßen / With kind regards,
> Julien Charon
> 
> Avitech GmbH
> Engineering AxL
> Tel.: +49 (0)7541/282-177
> Fax: +49 (0)7541/282-199
> e-mail: julien.charon@avitech.aero<ma...@avitech.aero>
> ________________________________________________
> Avitech GmbH
> Principal Office: Bahnhofplatz 1 | 88045 Friedrichshafen | Germany
> Court Registration: Amtsgericht Ulm | HRB 728293
> Geschäftsführer/Managing Director: Antonio Maria Gonzalez Gorostiza
> http://avitech.aero<http://avitech.aero/>
> 
> This message may contain confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.
> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com