find a better experience of WSSF

Topics: General Discussion Forum, Service Factory Modeling Edition Forum
Feb 18, 2008 at 2:17 AM
Edited Feb 18, 2008 at 5:47 AM
Hi,

I am a newbie working with WSSF ME and linq in vs2008(ASMX service) , i am not very sure how to do is better.

such as my ServiceImplementation generated code(GuestBookService.cs)
//GuestBookService.cs code:
public abstract class GuestBookServiceBase : System.Web.Services.WebService, Yardi.GustBook.WSSF.ASMX.ServiceContracts.IGuestBookServiceContract
{
#region GuestBookServiceContract Members
public virtual void SendMessage(Yardi.GustBook.WSSF.ASMX.ServiceContracts.SendMessageRequest request) {}
#endregion

}

ASMX::WebService(Namespace = "http://companyname.projectname.com/ServiceContracts", Name = "GuestBookService")
public partial class GuestBookService : GuestBookServiceBase
{
}
//cs code end here

My problem:
1.where to implement the method SendMessage is better?

Because i am using ASMX service, i didn't read the HOL WCF service sample.

Could anyone send me a better experience solution(including linq project and method implementation) to me.
my email address: gobullish # gmail.com, thanks very much in advanced.
Mar 5, 2008 at 6:17 PM
Even though you are using ASMX, go through the HOL anyway. Exercise 6 shows how to switch between WCF and ASMX and back again.

The HOL shows in Exercise 8 that your implementation doesn't go in that generated file at all. Instead, you create a new file in the ServiceImplementation project that contains the other part of this partial class. In it, you define a method that overrides the one in GuestBookServiceBase. E.g.:

public partial class GuestBookService
{
public override void SendMessage(Yardi.GustBook.WSSF.ASMX.ServiceContracts.SendMessageRequest request)
{
// TODO: translate Contract request to Business Entities
// TODO: invoke Business Logic
// TODO: translate Business Entity results to Contract
}
}

While the HOL puts the implemention in that override file, they recommend you go two steps further:

1. Create a new GuesBookServiceAdapter class that also implements the same IGuesBookServiceContract interface. The GuestBookService.SendMessage() method will just call the same method on the GuestBookServiceAdapter. Personally, I wouldn't blame somebody for skipping the service adapter.

2. Create a new class in the BusinessLogic project for each logical business operation. E.g., a SendMessageAction class in this case. These classes implement a single Execute() method that does the real work (talking to your data access layer, other services, etc).

Lots of levels of indirection.