Multiple Web Services with Same Business Object

D

djmc

Hi,

Say I have a business object Person and two have created two web services,
MyWebServices and MySSLWebServices. The first contains web services that do
not need to be secured, and the second is used for retrieving private data
over an SSL connection.

For instance, MyWebServices contains a GetPerson method that returns a
Person object with all of its sensitive information stripped (maybe the
Address property is taken out). However, the MySSLWebServices also has a
GetPerson method, but it returns Person objects in their full glory
including a populated Address property and other sensitive information.

I am consuming these two web services in another .NET application and the
web services proxy has created two Person objects. One is located at
MyWebServices.Person and the other at MySSLWebServices.Person. I have a
control that is for displaying Person objects but MyWebServices.Person and
MySSLWebServices.Person are not the same type. Rather than create a contol
for each of these, is there a way I can cast the object or use an interface
to somehow let my control display whichever Person object is passed in?

Thanks for any assistance!
-DJ
 
K

Khaled Hussein

Hello djmc,
if I understand you correctly, why don't you overload the method, property
or constructor that you pass in the person object to your control.
If the structure of the two classes is the same then in this case all you
have to do is just one control that takes in any one of those two classes's
objects. And then starts rendering it as it goes on.

I hope this helped
Thanks

--
Khaled Hussein
Graduate Teaching Assistant
College of Computing and Information Technology
Arab Academy for Science and Technology and Maritime Transport
(Great ideas start with completely unrealistic thoughts)
 
D

djmc

Hi, thanks for the reply.

Yeah, you're right. Just overloading my control's binding methods is not
that big a deal so I can go with that.

Thanks again
-DJ
 
H

Henrik Gøttig

Hi DJ

You could also make the type compatible.

Say SecurePerson inherits from Person.

If you are on .NET 2.0 you can use the /sharetypes switch on the command
line to wsdl.exe. By using that you make sure that types in your web
services is getting shared among service client proxies.

Regards

Henrik
 
D

djmc

Hey thanks a lot! This is pretty much what I was looking for.. I knew .net
had to have something like this.

Thanks again
-DJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top