By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,556 Members | 999 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,556 IT Pros & Developers. It's quick & easy.

Share a webservice reference between projects?

P: n/a
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.

Aug 28 '06 #1
Share this Question
Share on Google+
2 Replies

P: n/a
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

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


"Paul" wrote:
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.

Aug 28 '06 #2

P: n/a
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.
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:F7**********************************@microsof t.com...
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

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


"Paul" wrote:
>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.


Aug 28 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.