You are on the correct path!
The better design approach is to declare your interfaces first.
1) Declare interfaces
2) Implement this interface in your classes (C# class).
3) Implemtent the webservices classes from the same interface
4) In the WS, authenticate and authorize access to the business logic
implemented in your "true" classes (step 2).
Why?
Well - first of all it forces you to take a contract-first approach. Next it
allows you to call the logic from another "client" than the webservice that
exposes the methods. Second it de-couples the businss from the fact that it
is exposed as a webservices; not really a businnss entiity, is it?
Example:
public interfaces IOrder
{
string GetSomething(arguments...);
}
public class Order : IOrder
{
//..
}
[WebService]
public class OrderService : WebService, IOrder
{
[WebMethod]
public string GetSomething((arguments..)
{
//authorize
//if not allowed access - throw UnAuthorizedAccessException!
//instantiate businnss logic
//return data
}
}
--
rgds.
/Claus Konrad
MCSD.NET (C#)
"John Sitka" wrote:
Hi, sorry for a crosspost but that other news group was showing last post was a
week ago so I guess it dosen't see much use...
I'm about to start a solution and I'm curious about the approach of a webservices project.
Should the objects be represented in classes such as...
public class Orders (ie Orders.cs) within a project
and then have the service be in a class like OrdersService.asmx
public class OrdersService : System.Web.Services.WebService
and this class contain only [WebMethod] 's
I guess another another way to ask the same question is..
Would it be less desireable if a class inheriting System.Web.Services.WebService
contain methods that are not [Web Method]