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 / Languages / C# / August 2006

Tip: Looking for answers? Try searching our database.

Share a webservice reference between projects?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul - 28 Aug 2006 11:07 GMT
I have a class that references/consumes a webservice, and I would like to
split that class into a base class to be used as a based for classes in each
of two class libraries/DLLs.

I have extracted the base class into a cs file and inherit from it in two
class library projects by adding it to those projects using the "Link File"
option when adding an existing itme to each of those projects.

It all seems OK except the base class references the web service and needs
to have the web reference in a using clause prefixed with the project name,
however I don't want to specify the project name in a class file shared
between multiple projects.

Is the only way to solve this to put the base class in a seperate library
that also references the web service?  That seems messy to me - surely
there's another more elegant solution that I'm missing?

TIA

cheers,
Paul Ritchie.
Peter Bromberg [C# MVP] - 28 Aug 2006 11:58 GMT
When you say "project name", don't you really mean "Namespace"?

You can use XSD.EXE or WSDL.EXE to generate a completely self-contained
webservice proxy class.
Peter

Signature

Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com

> I have a class that references/consumes a webservice, and I would like to
> split that class into a base class to be used as a based for classes in each
[quoted text clipped - 17 lines]
> cheers,
> Paul Ritchie.
Paul - 28 Aug 2006 12:09 GMT
Thanks for your response Peter.

Well I had used a namespace that is different to the project name however
when I added the reference to the web service I seemed to need to prefix the
reference in the using clause with the project name rather than the
namespace.  I was confused by this behaviour for sure.

Thanks for the pointers on WSDL.EXE - that sounds like something that will
help.  I will then Link that generated proxy class into both projects
alongside the base class I assume - looking forward to the experimenting
anyway.

Thanks again Peter, much appreciated.

cheers,
Paul.

> When you say "project name", don't you really mean "Namespace"?
>
[quoted text clipped - 27 lines]
>> cheers,
>> Paul Ritchie.

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.