Annoying Web Service Compilation Issue

  • Thread starter Thread starter Rollasoc
  • Start date Start date
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
 
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
 
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
 
Back
Top