axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rajith Attapattu" <rajit...@gmail.com>
Subject Re: [axis2] use spring configured bean inside axis2 as implementation class
Date Fri, 04 Aug 2006 12:41:52 GMT
Hi Anderson,

Thanks for the feedback and I definitely appreciate it.
Once you are free please try out the fix by Dims to the class loading issue.
I guess that will take care of the main concern you have.

Also you don't have to expose your spring beans (the ones that implement the
business logic) directly to leverage the spring support.

also please see my comments inline.

Regards,

Rajith

On 8/3/06, Dave Andreasen < davea@knetica.com> wrote:
>
>   Hi Rajith,
>
>
>
> Here is how I am putting my application together.  I have a set of core
> services that are Spring beans.  I use Hibernate as my persistence tier.
> The Web services layer calls a Spring service that implements the business
> logic.
>
>
>
> Axis2's Spring support allows the developer to expose Spring beans as Web
> Services.  However, I don't really want to expose my Spring beans directly
> as Web Services.  My main motivation for this is that I can change the
> service interfaces without affecting my public Web services interface.  I
> can also hide some service interfaces that are used by other services but
> should not be publicly available (I could also just not expose them in the
> WSDL too).  I am also thinking it might help me with versioning down the
> road since I can have different Web service endpoints for different versions
> of my API.
>
[RA] You don't have to expose your spring beans (the ones that implement the
business logic) directly to leverage the spring support.

You could still have the WebService that calls your core spring beans (which
implements the business logic) as Spring beans. So you are not directly
exposing your business logic, but still you are using spring to wire your
web service with the spring beans that implement the business logic.

For example

public class MyWebService {

      private MyGreeting myGreeting;

      // let spring inject the dependency
      public void setMyGreeting(myGreeting){
          this.myGreeting = myGreeting;
      }

      public String greet(String name){
           return myGreeting.greetAccordingToTheTimeOfDay(name);
      }
}

//your business logic
public class MyGreetingImpl implements MyGreeting{

    public  String greetAccordingToTheTimeOfDay(String name){
        // if morning
           return "Good morning " + name:
       ....
    }

    public String greetWithLove(String name){
       // .....
   }
}

  My main issues with using Axis2 and Spring revolved around the Service
> classloader.  Spring likes to use the context classloader which does not
> have access to the resources deployed with the service.  I tried setting the
> classloader for Spring (one can set the classloader for the application
> context and the bean loader) but I ran into some problems with setting
> properties on Spring beans that I chalked up to permissions issues.  My
> current workaround is ugly but it works.  I deploy the Spring jars and the
> core services jar in the WEB-INF/lib for Axis2.  My service AAR just
> contains the Web Service skeletons.
>
>
>
> I do want to try the latest build.  The changes in the Service classloader
> look promising. Unfortunately I am going on vacation for a few days after
> today.  I am also trying to do a QA drop before I go so I am quite busy
> today.  That means I can't try the nightly build until late next week.  I
> would really like to not have to mess with the axis2.war so I am eager to
> try it out.
>
>
>
> Thanks for the quick response on the issue though.
>
>
>
> Dave
>  ------------------------------
>
> *From:* Rajith Attapattu [mailto:rajith77@gmail.com]
> *Sent:* Tuesday, August 01, 2006 7:50 PM
> *To:* axis-user@ws.apache.org; davea@knetica.com
> *Subject:* Re: [axis2] use spring configured bean inside axis2 as
> implementation class
>
>
>
> Anderson ,
>
> >I didn't use the extensions because they didn't apply to the approach we
> used for creating our Spring beans.  I did create an Axis module that loads
> my Spring >beans on Axis startup.
>
> Anderson if you don't mind I would like to hear about your use case about
> the spring bean creation. Perhaps we can improve our spring support based on
> your feedback.
>
> Regards,
>
> Rajith
>
> On 7/31/06, *Dave Andreasen* <davea@knetica.com> wrote:
>
> I had the same issue.  The problem is related to the Service using it's
> own classloader and Spring wanting to use the thread context classloader.
> See http://issues.apache.org/jira/browse/AXIS2-400.
>
>
>
> There have been some extensions made to support Spring in Axis2 in the
> nightly builds.  You try pulling them down to see if they help you out.
> Look at JIRA issue http://issues.apache.org/jira/browse/AXIS2-272 for more
> information
>
>
>
> I didn't use the extensions because they didn't apply to the approach we
> used for creating our Spring beans.  I did create an Axis module that loads
> my Spring beans on Axis startup.
>
>
>
> Hope this helps!
>
>
>
> Dave Andreasen
>
>
>  ------------------------------
>
> *From:* Shaowei Mao [mailto: smao@amindsolutions.com]
> *Sent:* Monday, July 31, 2006 2:59 PM
> *To:* axis-user@ws.apache.org
> *Subject:* [axis2] use spring configured bean inside axis2 as
> implementation class
>
>
>
> Hi, I am trying to use spring configured bean by creating spring container
> inside skeleton generated by wsdl2java to create my own implementation class
> for web service, but spring container BeanFactory can't load my classes
> packaged inside axis2 aar file. I think this is related to class loader
> aixs2 is using for each web service. Does anyone have sample code to solve
> this problem?
>
>
>
> Shaowei Mao
>
> aMind Solutions LLC
>
> Phone: 425-313-3107
>
> Email: smao@amindsolutions.com
>
> website: www.amindsolutions.com
>
>
>
>
>

Mime
View raw message