Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / November 2005

Tip: Looking for answers? Try searching our database.

Multiple Web Services with Same Business Object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
djmc - 01 Nov 2005 04:23 GMT
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
Khaled Hussein - 01 Nov 2005 11:43 GMT
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)

> Hi,
>
[quoted text clipped - 21 lines]
> Thanks for any assistance!
> -DJ
djmc - 01 Nov 2005 14:59 GMT
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

> Hello djmc,
> if I understand you correctly, why don't you overload the method, property
[quoted text clipped - 38 lines]
>> Thanks for any assistance!
>> -DJ
Henrik Gøttig - 02 Nov 2005 09:30 GMT
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

> Hi, thanks for the reply.
>
[quoted text clipped - 3 lines]
> Thanks again
> -DJ
djmc - 02 Nov 2005 22:44 GMT
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

> Hi DJ
>
[quoted text clipped - 17 lines]
>> Thanks again
>> -DJ

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.