I am working on a VB.Net application that needs to access a web service that I am nearly certain has a C# backend. At bare minimum, the backend is providing classes to me that are differentiated only by case, and within a number of those classes, there are properties and methods that are only differentiated by case.
VB.Net is case insensitive, and it sees a number of these items as being ambiguous.
I’ve thought of a few ways of dealing with this, but I would like suggestions before I go down a road that is likely difficult.
Here are some ways I have considered going about it.
-
Modifying the generated code for the wsdl. This has presented problems in responding as the xml output would no longer conform to the webservice requirements. I think there might be some attributes I could use to override this, but I’m not sure what they are yet. Even so, this web service gets frequent updates and I would hate to have to keep refixing the service every time I refreshed it.
-
Creating a csharp wrapper project where I expose the underlying classes with different names. Primarily through inheritance. Although the big problem here has been the issue with properties and methods that are only differentiated by case as well.
I’m sure at some point I could get one or the other of these solutions working, but if anyone has any better suggestions that I’m not thinking of, I’d appreciate the help.
Thank you
If the web service was developed in-house, you’ll want to review your company’s development practices; in particular, ensuring that all your public .NET APIs are CLS compliant.
If the web service was not developed in-house, or you can’t make changes to it (customers are already using it, etc.), then I would take the approach of either writing a C# wrapper library, or at least centralizing the calling code into a new (or existing) business-tier C# project. There’s a good chance you’ll want to do this kind of abstraction anyway, instead of calling web methods directly from the application tier.