yes, thats sort of what Im doing now.
Maybe I should look at converting this Web Service App into a Wcf
Service App.

Off topic, but do people still use web service apps now, or is
everyone going straight for Wcf service Application project?

On May 6, 11:06 am, Callum Hibbert <[email protected]> wrote:
> No, sorry. I saw "web service" and assumed WCF underneath. Castle works with
> WCF because WCF have lots of extension points (like the Service Factory).
> There are no equivalent hooks in the ASMX infrastructure.
> If I were you and stuck with ASMX, I'd have the web service class as a
> simple wrapper to an underlying class that has the same methods but contains
> all the code. Something like...
>
> public class MyWebService
> {
>   public void MyWebMethod(Request request)
>   {
>     IMyWebServiceLogic logic = container.Resolve< IMyWebServiceLogic>();
>     logic.MyWebMethod(request);
>   }
>
> }
>
> Your "IMyWebServiceLogic" implementor can have dependency injection as
> normal and is then highly testable.
>
> Bit of a hack but if you're working with ASMX its probably about the only
> thing you can do.
>
> Callum
>
> On Wed, May 6, 2009 at 10:57 AM, Andyk <[email protected]> wrote:
>
> > Actually, this is for a WCF service. Will the same principle work when
> > using a ASP.Net Web Service Application?
>
> > On May 6, 10:54 am, Andyk <[email protected]> wrote:
> > > Ah great, thanks Callum, I'll take a look.
>
> > > On May 6, 10:50 am, Callum Hibbert <[email protected]> wrote:
>
> > > > I forgot, I posted a complete example myself a while back:
> >http://callumhibbert.blogspot.com/2008/02/wcf-services-and-dependency...
>
> > > > Callum
>
> > > > On Wed, May 6, 2009 at 10:41 AM, Andyk <[email protected]>
> > wrote:
>
> > > > > Ok I think Im getting somewhere. I think I need to use the
> > > > > IContainerAccessor in my global.cs file, and instantiate the
> > container
> > > > > in the app_start.
> > > > > Then when there's an incoming request, windsor will instantiate the
> > > > > webservice class.
> > > > > Am I getting warmer?
>
> > > > > On May 6, 9:54 am, AndyKnight <[email protected]> wrote:
> > > > > > Hi all,
> > > > > > Im trying to find a way of using windsor with my webservice and
> > > > > > wondered if anyone can help me or point me in the right direction?
> > > > > > My problem is, how exactly does a webservice class get instantiated
> > > > > > when there's an incoming request, and how do I override that to use
> > > > > > the class from the windsor container instead?
>
> > > > > > Right now, my web service contains lots of references to my static
> > > > > > windsor container, like: Ioc.Resolve<IAccountService>, which makes
> > > > > > unit testing the webservice class very hard.
>
> > > > > > kind regards
>
> > > > > > Andy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to