WCSF and simple web service consumption.

Topics: Web Client Software Factory, UIP Application Block discussion
Mar 13, 2007 at 6:19 PM
Hi. I'm sorry if I sound dense here, as I am totally new to WCSF. I got it all installed and running, and then slowly integrated my master pages, views/code-behinds, and ported my biz tier layer into a module. So far, so good. The Atlas (AJaX) controls all appear to be working well, although I haven't implemented controllers on all pages yet.

I want to consume a simple web service (Think 'hello patterns and paractices') in my app. I add a web reference in the usual manner, but when I try to call it in the code behind, the WS object isn't reference-able. I am thinking I must now go through implementing the complete web services software factory implementation as well (register services, etc.)??

Is this the right approach? Anyone care to write a quick 'howto' for a newbie like me on how to utilize a simple web service in a WCSF project?

I think it would behoove the community for a few beginner quick guides to be posted.. like a 'how to start out with enterprise library with WCSF' and 'how to use a basic web service with WCSF', 'how to construct and utilize a simple controller' etc.

The WCSF seems to have amazing potential and I think some jump starts like these would really grow the ASP.NET developer base.
Mar 13, 2007 at 7:16 PM
Totally agree with your comments re: simple howto's - some have appeared on blogs already and hopefully this will increase with time.

I'd recommend checking out the Reference Implementation and Quick Starts in the WCSF source (a separate MSI included in the download and installed by the main installer). The Ref Implementation includes some service proxies that you can use as an example.

I've also implemented service proxies in a recent delivery, but I've used a somewhat simpler pattern due to the straightforward nature of what I needed. Basically I've created an interface IMyService, and then implemented a RemoteMyService class that acts as the service proxy (wrapping the web service calls). Then in my Service Agents foundational module I've registered RemoteMyService as a global service of type IMyService.

This means any controller can get a reference to the service proxy using Object Builder syntax in the constructor's parameters; ServiceDependency IMyService myService.

Hope that's clear!

I'd be interested in what everyone thinks to the various approaches or what other ones have been used. I've used this one as there is zero business logic in my web app - it is all hosted in remote web services, and the web app pretty much gets the data and displays it in lists etc. If it was more complex than that I'd probably wrap it a bit more with some business logic classes.