Share a webservice reference between projects?


P

Paul

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.
 
Ad

Advertisements

G

Guest

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
 
Ad

Advertisements

P

Paul

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.
 

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

Top