You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by ri...@multi-support.com on 2007/08/20 09:40:47 UTC

Axis2: Configure Axis dynamicly (SpringAware)

Hi,

I would like hear if it some how is possible to configure Axis2 dynamic as
the following in my service descriptor.

<serviceGroup>
      <service name="MyService">
          <parameter name="ServiceObjectSupplier">
org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier
</parameter>
          <parameter name="SpringBeanName">myService</parameter>
          <operation name="getJob">
            <messageReceiver class=
"org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
          </operation>
          <operation name="setStatus">
            <messageReceiver class=
"org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
          </operation>
      </service>
</serviceGroup>

I now it is possible configure Axis2 dynamic with ordinary services using
AxisService.createService(...), but how do I do it with Spring enabled
services?

//Configure Axis2 dynamic without spring support.
Map<String, MessageReceiver> mep = new HashMap<String, MessageReceiver>();
mep.put("http://www.w3.org/2004/08/wsdl/in-only", RPCInOnlyMessageReceiver.
class.newInstance());
mep.put("http://www.w3.org/2004/08/wsdl/in-out", RPCMessageReceiver.class
.newInstance());
ConfigurationContext config = ConfigurationContextFactory.
createConfigurationContextFromFileSystem(null,null);
AxisService service = AxisService.createService("MyService.class",
config.getAxisConfiguration(), mep, null, null, BufferFactory.class
.getClassLoader());
config.getAxisConfiguration().addService(service);


Regards
Multi-Support A/S

Torben Riis
--------------------------------------------------------------------
Phone +45 96 600 600, Fax +45 96 600 601
E-mail: riis@multi-support.com
http://www.multi-support.com


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Axis2: Configure Axis dynamicly (SpringAware)

Posted by robert lazarski <ro...@gmail.com>.
Take a look at the spring unit tests in the source and specifically
the way the axis2 test harness works. That should help you understand
a bit on what you need to do.

HTH,
Robert

On 8/29/07, riis@multi-support.com <ri...@multi-support.com> wrote:
>
> Hi,
>
> I have looked at this for a while now but I still have some problems
> figuring it out. Hope someone is able to help me here! ;-)
>
> I can see that makeNewServiceObject(ctx) in AbstractMessageReceiver tests
> on AxisService parameters to determine whether to receive its service
> object by a ServiceObjectSupplier or to create it with reflection. I
> thought it then would be possible to use AxisService.createService() to
> obtain a basic AxisService where I removed the parameter Constants.
> SERVICE_CLASS and added Constants.SERVICE_OBJECT_SUPPLIER&
> SpringAppContextAwareObjectSupplier.SERVICE_SPRING_BEANNAME. But it doesn't
> seam to be the right way to do this. Do I need to instantiate the
> AxisService by my self and in such case, what must be set on this object as
> minimum?
>
> //My guess
> ConfigurationContext config =
> ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,null);
> AxisService service = AxisService.createService("com.firm.MyService",
> config.getAxisConfiguration());
>
> service.removeParameter(service.getParameter(Constants.SERVICE_CLASS));
> service.addParameter(Constants.SERVICE_OBJECT_SUPPLIER,
> "org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier");
> service.addParameter(SpringAppContextAwareObjectSupplier.SERVICE_SPRING_BEANNAME,
>  "myBeanName");
>
> config.getAxisConfiguration().addService(service);
>
> Regards
> Multi-Support A/S
>
> Torben Riis
> --------------------------------------------------------------------
> Phone +45 96 600 600, Fax +45 96 600 601
> E-mail: riis@multi-support.com
> http://www.multi-support.com
>
>
>
>              "robert lazarski"
>              <robertlazarski@g
>              mail.com>                                                  To
>                                        axis-user@ws.apache.org
>              20-08-2007 14:38                                           cc
>
>                                                                    Subject
>              Please respond to         Re: Axis2: Configure Axis dynamicly
>              axis-user@ws.apac         (SpringAware)
>                   he.org
>
>
>
>
>
>
>
>
>
> Using SpringAppContextAwareObjectSupplier, you have the option of
> using the the same ApplicationContextHolder class that axis2 uses.
> Also, take a look at the AbstractMessageReceiver, ie, looking at the
> source in this part of axis2 should point you in the right direction.
>
> HTH,
> Robert
>
> On 8/20/07, riis@multi-support.com <ri...@multi-support.com> wrote:
> >
> > Hi,
> >
> > I would like hear if it some how is possible to configure Axis2 dynamic
> as
> > the following in my service descriptor.
> >
> > <serviceGroup>
> >       <service name="MyService">
> >           <parameter name="ServiceObjectSupplier">
> >
> org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier
>
> > </parameter>
> >           <parameter name="SpringBeanName">myService</parameter>
> >           <operation name="getJob">
> >             <messageReceiver class=
> > "org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
> >           </operation>
> >           <operation name="setStatus">
> >             <messageReceiver class=
> > "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
> >           </operation>
> >       </service>
> > </serviceGroup>
> >
> > I now it is possible configure Axis2 dynamic with ordinary services using
> > AxisService.createService(...), but how do I do it with Spring enabled
> > services?
> >
> > //Configure Axis2 dynamic without spring support.
> > Map<String, MessageReceiver> mep = new HashMap<String,
> MessageReceiver>();
> > mep.put("http://www.w3.org/2004/08/wsdl/in-only",
> RPCInOnlyMessageReceiver.
> > class.newInstance());
> > mep.put("http://www.w3.org/2004/08/wsdl/in-out", RPCMessageReceiver.class
> > .newInstance());
> > ConfigurationContext config = ConfigurationContextFactory.
> > createConfigurationContextFromFileSystem(null,null);
> > AxisService service = AxisService.createService("MyService.class",
> > config.getAxisConfiguration(), mep, null, null, BufferFactory.class
> > .getClassLoader());
> > config.getAxisConfiguration().addService(service);
> >
> >
> > Regards
> > Multi-Support A/S
> >
> > Torben Riis
> > --------------------------------------------------------------------
> > Phone +45 96 600 600, Fax +45 96 600 601
> > E-mail: riis@multi-support.com
> > http://www.multi-support.com
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Axis2: Configure Axis dynamicly (SpringAware)

Posted by ri...@multi-support.com.
Hi,

I have looked at this for a while now but I still have some problems
figuring it out. Hope someone is able to help me here! ;-)

I can see that makeNewServiceObject(ctx) in AbstractMessageReceiver tests
on AxisService parameters to determine whether to receive its service
object by a ServiceObjectSupplier or to create it with reflection. I
thought it then would be possible to use AxisService.createService() to
obtain a basic AxisService where I removed the parameter Constants.
SERVICE_CLASS and added Constants.SERVICE_OBJECT_SUPPLIER&
SpringAppContextAwareObjectSupplier.SERVICE_SPRING_BEANNAME. But it doesn't
seam to be the right way to do this. Do I need to instantiate the
AxisService by my self and in such case, what must be set on this object as
minimum?

//My guess
ConfigurationContext config =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(null,null);
AxisService service = AxisService.createService("com.firm.MyService",
config.getAxisConfiguration());

service.removeParameter(service.getParameter(Constants.SERVICE_CLASS));
service.addParameter(Constants.SERVICE_OBJECT_SUPPLIER,
"org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier");
service.addParameter(SpringAppContextAwareObjectSupplier.SERVICE_SPRING_BEANNAME,
 "myBeanName");

config.getAxisConfiguration().addService(service);

Regards
Multi-Support A/S

Torben Riis
--------------------------------------------------------------------
Phone +45 96 600 600, Fax +45 96 600 601
E-mail: riis@multi-support.com
http://www.multi-support.com


                                                                           
             "robert lazarski"                                             
             <robertlazarski@g                                             
             mail.com>                                                  To 
                                       axis-user@ws.apache.org             
             20-08-2007 14:38                                           cc 
                                                                           
                                                                   Subject 
             Please respond to         Re: Axis2: Configure Axis dynamicly 
             axis-user@ws.apac         (SpringAware)                       
                  he.org                                                   
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Using SpringAppContextAwareObjectSupplier, you have the option of
using the the same ApplicationContextHolder class that axis2 uses.
Also, take a look at the AbstractMessageReceiver, ie, looking at the
source in this part of axis2 should point you in the right direction.

HTH,
Robert

On 8/20/07, riis@multi-support.com <ri...@multi-support.com> wrote:
>
> Hi,
>
> I would like hear if it some how is possible to configure Axis2 dynamic
as
> the following in my service descriptor.
>
> <serviceGroup>
>       <service name="MyService">
>           <parameter name="ServiceObjectSupplier">
>
org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier

> </parameter>
>           <parameter name="SpringBeanName">myService</parameter>
>           <operation name="getJob">
>             <messageReceiver class=
> "org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
>           </operation>
>           <operation name="setStatus">
>             <messageReceiver class=
> "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
>           </operation>
>       </service>
> </serviceGroup>
>
> I now it is possible configure Axis2 dynamic with ordinary services using
> AxisService.createService(...), but how do I do it with Spring enabled
> services?
>
> //Configure Axis2 dynamic without spring support.
> Map<String, MessageReceiver> mep = new HashMap<String,
MessageReceiver>();
> mep.put("http://www.w3.org/2004/08/wsdl/in-only",
RPCInOnlyMessageReceiver.
> class.newInstance());
> mep.put("http://www.w3.org/2004/08/wsdl/in-out", RPCMessageReceiver.class
> .newInstance());
> ConfigurationContext config = ConfigurationContextFactory.
> createConfigurationContextFromFileSystem(null,null);
> AxisService service = AxisService.createService("MyService.class",
> config.getAxisConfiguration(), mep, null, null, BufferFactory.class
> .getClassLoader());
> config.getAxisConfiguration().addService(service);
>
>
> Regards
> Multi-Support A/S
>
> Torben Riis
> --------------------------------------------------------------------
> Phone +45 96 600 600, Fax +45 96 600 601
> E-mail: riis@multi-support.com
> http://www.multi-support.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Axis2: Configure Axis dynamicly (SpringAware)

Posted by robert lazarski <ro...@gmail.com>.
Using SpringAppContextAwareObjectSupplier, you have the option of
using the the same ApplicationContextHolder class that axis2 uses.
Also, take a look at the AbstractMessageReceiver, ie, looking at the
source in this part of axis2 should point you in the right direction.

HTH,
Robert

On 8/20/07, riis@multi-support.com <ri...@multi-support.com> wrote:
>
> Hi,
>
> I would like hear if it some how is possible to configure Axis2 dynamic as
> the following in my service descriptor.
>
> <serviceGroup>
>       <service name="MyService">
>           <parameter name="ServiceObjectSupplier">
> org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier
> </parameter>
>           <parameter name="SpringBeanName">myService</parameter>
>           <operation name="getJob">
>             <messageReceiver class=
> "org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
>           </operation>
>           <operation name="setStatus">
>             <messageReceiver class=
> "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
>           </operation>
>       </service>
> </serviceGroup>
>
> I now it is possible configure Axis2 dynamic with ordinary services using
> AxisService.createService(...), but how do I do it with Spring enabled
> services?
>
> //Configure Axis2 dynamic without spring support.
> Map<String, MessageReceiver> mep = new HashMap<String, MessageReceiver>();
> mep.put("http://www.w3.org/2004/08/wsdl/in-only", RPCInOnlyMessageReceiver.
> class.newInstance());
> mep.put("http://www.w3.org/2004/08/wsdl/in-out", RPCMessageReceiver.class
> .newInstance());
> ConfigurationContext config = ConfigurationContextFactory.
> createConfigurationContextFromFileSystem(null,null);
> AxisService service = AxisService.createService("MyService.class",
> config.getAxisConfiguration(), mep, null, null, BufferFactory.class
> .getClassLoader());
> config.getAxisConfiguration().addService(service);
>
>
> Regards
> Multi-Support A/S
>
> Torben Riis
> --------------------------------------------------------------------
> Phone +45 96 600 600, Fax +45 96 600 601
> E-mail: riis@multi-support.com
> http://www.multi-support.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org