C# Client for 3rd party webservice: Method xxx could not be reflected
I generated a load of code from a set of services using wsdl.exe and wanted to share types for several services, because I didn't want a new proxy class for each service. So then I wanted a nice uniform access to each service so I hacked the generated code and wrote an abstract class BaseService deriving from SoapHttpClientProtocol, and manually altered each class to derive from BaseService, rather than each service deriving from SoapHttpClientProt开发者_如何学Goocol themselves. The base has a protected constructor and a protected string field AddressRelative.
All the proxy classes call the base constructor, and do nothing else on construction, and override the field with the particular address extension for where their services are located. The services are arranged so that they all share a base url, so the AddressRelative makes sure all of the proxies know their own url.
I get a weird error when I try to construct a proxy object of one of the classes - I get an exception thrown at the point of entering the BaseService constructor. The exception's InnerException is Method xxx could not be reflected. The method does call a service by reflection, but why throw on construction, construction of the base?! Any ideas?
精彩评论