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 David Land <da...@eurekasoft.com> on 2008/08/01 18:56:13 UTC

Integrating Axis 1.3 and Spring

I have a question about integrating Axis 1.3 with Spring. I want to
implement an AOP logging solution for a set of Axis web services.
Basically, I want to be able to do some logging and the beginning and
end of each web service method. My question is regarding how to get Axis
to use an instance of the Spring AOP proxy class.

 

The only solution I could find for doing it was to create a dummy web
service class that inherits from
org.springframework.remoting.jaxrpc.ServletEndpointSupport and then to
override the onInit() method to set a class variable to the AOP object
returned from the Spring application context. Then in each of the dummy
web service's methods, call the corresponding method on the AOP object.
Here is a typical example:

-----------------------------------------------------------------------
public class DummyService extends ServletEndpointSupport implements
IRealWebService {
   private IRealWebService real;

   protected void onInit() {
      this. real =
(IRealWebService)getWebApplicationContext().getBean("wsBean");
   }

   public String sayHello(String message) {
      return real.sayHello(message);
   }

 

   public String doSomethingElse (String message) {
      return real. doSomethingElse (message);
   }
}
-----------------------------------------------------------------------

I'm not a huge fan of this solution because it requires you to keep
around this dummy class that doesn't do anything but create and call the
Spring generated proxy. Then every time you want add a new method to the
web service you would have to go back and update the dummy class as
well. Isn't there a way to get Axis to instantiate and use the AOP proxy
object from the Spring application context? Maybe some lower level
handler in Axis can be overridden so you can inject the Spring object?

 

It's my understanding that Axis2 has better support for Spring, but
using Axis2 is not an option at this point.

 

Thanks,

Dave


RE: Integrating Axis 1.3 and Spring

Posted by David Land <da...@eurekasoft.com>.
Sagara,

 

Thanks for the information. Unfortunately, the use of Axis2 is not an
option at this point. We're using Axis 1 version 1.3, which apparently
does not have good support for integration with Spring.  I can see why
you would get confused though, the naming conventions are bizarre. Can't
we come up with a more distinct name than Axis2? Things like "Axis2
version 1.4" sound weird unintuitive. How about a totally different
name? How about Atlas? Or Allies? Or X-Axis? Or Tilt? Or anything but
the same name with a pseudo version number tacked on the end.

 

Dave

 

From: Sagara Gunathunga [mailto:sagara.gunathunga@gmail.com] 
Sent: Monday, August 04, 2008 10:37 PM
To: axis-user@ws.apache.org
Subject: Re: Integrating Axis 1.3 and Spring

 

Hi Dave,
I'm not sure about your question ,  but Spring user guide [1] shows  how
you can access beans defined in  the Spring application context. you
don't need to modify you Spring application context file , but need to
define "ServiceObjectSupplier" parameter in the service.xml file. 

When you come to Spring AOP proxy beans you need one more extra step to
define "ServiceClass" parameter in the service.xml file . Recently i
have done a  such example ,please refer following blog entry [2] for
more details .


[1] - http://ws.apache.org/axis2/1_4/spring.html
[2] - http://ssagara.blogspot.com/2008/08/axis2-with-spring-aop.html

Hope this will help you ,

Regards ,

Sagara Gunathunga 

Blog - ssagara.blogspot.com
Web - http://sagaras.awardspace.com/

On Fri, Aug 1, 2008 at 10:26 PM, David Land <da...@eurekasoft.com>
wrote:

I have a question about integrating Axis 1.3 with Spring. I want to
implement an AOP logging solution for a set of Axis web services.
Basically, I want to be able to do some logging and the beginning and
end of each web service method. My question is regarding how to get Axis
to use an instance of the Spring AOP proxy class.

 

The only solution I could find for doing it was to create a dummy web
service class that inherits from
org.springframework.remoting.jaxrpc.ServletEndpointSupport and then to
override the onInit() method to set a class variable to the AOP object
returned from the Spring application context. Then in each of the dummy
web service's methods, call the corresponding method on the AOP object.
Here is a typical example:

-----------------------------------------------------------------------
public class DummyService extends ServletEndpointSupport implements
IRealWebService {
   private IRealWebService real;

   protected void onInit() {
      this. real =
(IRealWebService)getWebApplicationContext().getBean("wsBean");
   }

   public String sayHello(String message) {
      return real.sayHello(message);
   }

 

   public String doSomethingElse (String message) {
      return real. doSomethingElse (message);
   }
}
-----------------------------------------------------------------------

I'm not a huge fan of this solution because it requires you to keep
around this dummy class that doesn't do anything but create and call the
Spring generated proxy. Then every time you want add a new method to the
web service you would have to go back and update the dummy class as
well. Isn't there a way to get Axis to instantiate and use the AOP proxy
object from the Spring application context? Maybe some lower level
handler in Axis can be overridden so you can inject the Spring object?

 

It's my understanding that Axis2 has better support for Spring, but
using Axis2 is not an option at this point.

 

Thanks,

Dave




-- 


Re: Integrating Axis 1.3 and Spring

Posted by Sagara Gunathunga <sa...@gmail.com>.
Hi Dave,
I'm not sure about your question ,  but Spring user guide [1] shows  how you
can access beans defined in  the Spring application context. you don't need
to modify you Spring application context file , but need to define
"ServiceObjectSupplier" parameter in the service.xml file.

When you come to Spring AOP proxy beans you need one more extra step to
define "ServiceClass" parameter in the service.xml file . Recently i have
done a  such example ,please refer following blog entry [2] for more details
.


[1] - http://ws.apache.org/axis2/1_4/spring.html
[2] - http://ssagara.blogspot.com/2008/08/axis2-with-spring-aop.html

Hope this will help you ,

Regards ,

Sagara Gunathunga

Blog - ssagara.blogspot.com
Web - http://sagaras.awardspace.com/

On Fri, Aug 1, 2008 at 10:26 PM, David Land <da...@eurekasoft.com> wrote:

>  I have a question about integrating Axis 1.3 with Spring. I want to
> implement an AOP logging solution for a set of Axis web services. Basically,
> I want to be able to do some logging and the beginning and end of each web
> service method. My question is regarding how to get Axis to use an instance
> of the Spring AOP proxy class.
>
>
>
> The only solution I could find for doing it was to create a dummy web
> service class that inherits from
> org.springframework.remoting.jaxrpc.ServletEndpointSupport and then to
> override the onInit() method to set a class variable to the AOP object
> returned from the Spring application context. Then in each of the dummy web
> service's methods, call the corresponding method on the AOP object. Here is
> a typical example:
>
> -----------------------------------------------------------------------
> public class DummyService extends ServletEndpointSupport implements
> IRealWebService {
>    private IRealWebService real;
>
>    protected void onInit() {
>       this. real =
> (IRealWebService)getWebApplicationContext().getBean("wsBean");
>    }
>
>    public String sayHello(String message) {
>       return real.sayHello(message);
>    }
>
>
>
>    public String doSomethingElse (String message) {
>       return real. doSomethingElse (message);
>    }
> }
> -----------------------------------------------------------------------
>
> I'm not a huge fan of this solution because it requires you to keep around
> this dummy class that doesn't do anything but create and call the Spring
> generated proxy. Then every time you want add a new method to the web
> service you would have to go back and update the dummy class as well. Isn't
> there a way to get Axis to instantiate and use the AOP proxy object from the
> Spring application context? Maybe some lower level handler in Axis can be
> overridden so you can inject the Spring object?
>
>
>
> It's my understanding that Axis2 has better support for Spring, but using
> Axis2 is not an option at this point.
>
>
>
> Thanks,
>
> Dave
>



--