Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > an architecture based on webservice

Reply
Thread Tools

an architecture based on webservice

 
 
Francesco Spegni
Guest
Posts: n/a
 
      06-19-2007
hi there,

i hope this message is not out of topic. i've a question about how to
realize a small architecture based on webservice and whose goal is
ensure a good level o flexibility of my code.

in a few words: i've a webservice which exports the method
Authenticate(User usCurrUser). the data type User should be an
abstract class like this:

public abstract class User
{
public abstract bool Validate();
}

what i wish to do would be to create a subclass of it like

public abstract class UserSub : User
{
public UserSub(string strUserId, string strPassword)
{
...<the actual code>...
}

public override bool Validate()
{
...<the actual code>...
}
}

and pass an istance of the subclass to the webservice. the behavior i
expect is that the webservice, calling the abstract method Validate(),
will indeed call the Validate() method specified in the UserSub
class.

why all this? i guess you can easily imagine that if i'm able to
realize this i can change the way to authenticate my users (let's say
no more by userid and password but, instead, by fingerprints) without
need to change the proxy through which my client application calls the
webservice. i "just" need to change the webservice code and the client
code.

i've googled a bit, but i still cannot figure how to realize an
architecture like this. does any of you have some suggestion for my
problem?

i thank you in advance for any help you can give me,

have a nice day

francesco

 
Reply With Quote
 
 
 
 
John Saunders [MVP]
Guest
Posts: n/a
 
      06-19-2007
"Francesco Spegni" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> hi there,
>
> i hope this message is not out of topic. i've a question about how to
> realize a small architecture based on webservice and whose goal is
> ensure a good level o flexibility of my code.
>
> in a few words: i've a webservice which exports the method
> Authenticate(User usCurrUser). the data type User should be an
> abstract class like this:
>
> public abstract class User
> {
> public abstract bool Validate();
> }
>
> what i wish to do would be to create a subclass of it like
>
> public abstract class UserSub : User
> {
> public UserSub(string strUserId, string strPassword)
> {
> ...<the actual code>...
> }
>
> public override bool Validate()
> {
> ...<the actual code>...
> }
> }
>
> and pass an istance of the subclass to the webservice. the behavior i
> expect is that the webservice, calling the abstract method Validate(),
> will indeed call the Validate() method specified in the UserSub
> class.


Francesco,

You can't do this with web services. They deal in data only. They cannot
pass instances of an object with methods. Consider the following:

public class UserBase
{
public virtual string SomeMethod()
{
return "UserBase";
}
}

public class UserDerived : UserBase
{
public override string SomeMethod()
{
return "UserDerived";
}
}

[WebService]
public class MyUserService
{
[WebMethod]
public void UserBase GetUser(int userID)
{
// look up user
// return user
}
}

-----------
On the client:

using (MyUserService service = new MyUserService())
{
UserBase user = service.GetUser(1);
Console.WriteLine(user.SomeMethod()); // Will not compile - no such
method
}

This will not compile because the client proxy class only reflects the
"data" portion of the UserBase and UserDerived classes. The data are
described by XML Schema that is referenced by the WSDL (Web Service
Description Language) that .NET generates from the web service. But there is
nothing in WSDL or XML Schema that can describe class methods (except for
the methods of a web service).


You could accomplish what you want through .NET remoting, if remote
operation is part of your requirements.
--
John Saunders [MVP]


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
collocated architecture versus distributed architecture apngss@yahoo.com C Programming 3 09-29-2005 07:44 AM
collocated architecture versus distributed architecture apngss@yahoo.com Java 3 09-29-2005 07:44 AM
collocated architecture versus distributed architecture apngss@yahoo.com C++ 4 09-29-2005 07:44 AM
ON Linux Platform: How can we build binaries for another architecture from 0x86 architecture rashmi C Programming 2 07-05-2005 02:31 PM
how can I use a signal defined in one Architecture to another Architecture Muhammad Khan VHDL 4 07-10-2003 06:14 PM



Advertisments