Annoying Web Service Compilation Issue

R

Rollasoc

Ok, this is going to be a bit difficult to explain, since it is
slightly convoluted.

I have a c# DLL. Lets call it Common.DLL
It contains base classes and enums and structs etc
Lets say it has an enum called Mode.


I have two Webservices. Call them A and B.
Both of these webservices reference Common.DLL


Webservice A has a function on it public void myfunction(Common.Mode
myMode)


Webservice B references webservice A.


Now in a function in B, I declare a variable of A's service and
instantiate it.


When I call myfunction I get a compilation error


Argument '1': cannon convert from 'Common.Mode' to 'A.Mode'


Why does it do this, when A's declaration says it is Common.Mode.
Why is it trying to use A.Mode?
How can I fix this so it compiles (without the obvious using A.Mode
casting since I need to pass the mode into calls to Common.DLL
later)?

I posted this in the webservice group a few days ago, but no luck, so
posting this now with wider scope.

Rollasoc
 
M

Marc Gravell

when A's declaration says it is Common.Mode.

When you add a web-reference, it will create proxy objects that are
completely isolated from anything else, even if they look identical. So
if you have 2 web-references (one to A, one to B) then service A will
want to use A.Mode.
So; are you sure A uses Common.Mode?

If you use the command line, tools like wsdl.exe allow you to use the
/sharetypes switch and specify multiple urls to generate a single set of
proxies for all those services - so the same Model will be used for A
and B, but it still won't be Common.Mode.

If you want to use assembly sharing (to use Common.Mode on the service),
then you can do this with WCF, but not with asmx AFAIK.

Marc
 
R

Rollasoc

Marc,

Thanks for that....

I've sussed the problem now, with some help from my boss.
Essentially, someone in the past here write a visual studio addin /
assembly thing that manages the
shared types across the DLLs. I hadn't installed it when I rebuilt my
PC. (since I didn't know it existed). I have now installed the
assembly in the GAC and my code now compiles.

Thanks again for taking the time to answer me.

Rollasoc
 

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