J
JupiterMoonBeam
Hello,
I wonder if anyone can help.
As a rule I have a design policy of programming to interfaces
especially with 'data' classes. I like a client to be responsible for
implementing its own version of classes it sends to a service rather
than the service dictating what the class should be. This provides
immense flexibility and is a good practice. For example in a web
application if I need to submit a login I have a service with the
method:
public bool Logon(ILogonCredentials);
And then on the web page I can do:
public class MyPage: ILogonCredentials
{
public string ILogonCredentials.UserName
{
get { return UserNameTextBox.Text; }
}
public string ILogonCredentials.Password
{
get { return PasswordTextBox.Text; }
}
public void LogonOnClick(...)
{
LogonService.Logon(this);
}
}
There are also other reasons for doing this as I can implement
different class logic in web apps over desktop apps etc.
The problem I am having is trying to establish how to do this with web
services. I understand that the web service itself MUST implement a
real class to desirialize the request to but when I add a web reference
in VisualStudio 2005 I want to be given interfaces for the objects that
are serialized/deserialized between the service and client (though not
for the service itself) so I can be free to use the benefits of
polymorphism and have multiple implementations of the interfaces
through my clients.
I know it's completely technically possible to do as I have do it
easily by editing the auto generated code but this is a BAD thing (as
VS will just nuke it at will) and I don't want to be having to manually
write my proxy's with all the events and yuk yuk yuk.
Any help would be GREATLY appreciated: I wan't to use some OOP
techniques in a OOP language and I know it must be possible I just need
the secret key.
Many thanks in advance.
I wonder if anyone can help.
As a rule I have a design policy of programming to interfaces
especially with 'data' classes. I like a client to be responsible for
implementing its own version of classes it sends to a service rather
than the service dictating what the class should be. This provides
immense flexibility and is a good practice. For example in a web
application if I need to submit a login I have a service with the
method:
public bool Logon(ILogonCredentials);
And then on the web page I can do:
public class MyPage: ILogonCredentials
{
public string ILogonCredentials.UserName
{
get { return UserNameTextBox.Text; }
}
public string ILogonCredentials.Password
{
get { return PasswordTextBox.Text; }
}
public void LogonOnClick(...)
{
LogonService.Logon(this);
}
}
There are also other reasons for doing this as I can implement
different class logic in web apps over desktop apps etc.
The problem I am having is trying to establish how to do this with web
services. I understand that the web service itself MUST implement a
real class to desirialize the request to but when I add a web reference
in VisualStudio 2005 I want to be given interfaces for the objects that
are serialized/deserialized between the service and client (though not
for the service itself) so I can be free to use the benefits of
polymorphism and have multiple implementations of the interfaces
through my clients.
I know it's completely technically possible to do as I have do it
easily by editing the auto generated code but this is a BAD thing (as
VS will just nuke it at will) and I don't want to be having to manually
write my proxy's with all the events and yuk yuk yuk.
Any help would be GREATLY appreciated: I wan't to use some OOP
techniques in a OOP language and I know it must be possible I just need
the secret key.
Many thanks in advance.