webservice reference shenanigans

68 views Asked by At

I have a .net webservice (passthrough WS) that passes through to another one (underlying WS), passing a particular custom object. both WS's include the assembly with the particular custom object class in, but when i add the service reference to the underlying WS to the passthrough WS , .net generates its own type of this class , in the passthough WS namespace. this then means that I have to use this other object in a different namespace instead of the one it really is- really duplicating the 'real' class/object. maybe i am not explaning this very well.

i could i guess go in by hand to the .net generated service class and replace the generated object with the 'correct' one, but i would have to do that each time the underlying service was updated. a bit of a pain to say the least. this clearly also affects the return types as well as the arguments the webmethods are called with.. dagnamit!

is there a way around this? ideally i would like both WS's to use the same objects. or am i going to have to add constructors to the generated objects that take the underlying ones and just assign all the properties like that? - i hope not....

i realise that WS's have to be platform independent, using types that should be accessible from not just .net or whatever.. so is the idea to make sure you are using just these base types and instead of wrapping them all up in a custom object, to pass in all these 'properties' as separate arguments? any help much appreciated

thanks

nat

1

There are 1 answers

0
Maxim Gueivandov On BEST ANSWER

If you are using legacy (aka old school) ASP.NET webservices, you have basically 2 options:

  1. Convert them to WCF services and use Service References (instead of simple References) to consume them. WCF Services support reuse of classes.

  2. If you want to stay with the legacy web service technology, you will have to go the hard way by customizing the way the proxy class is generated.