Monday, August 17, 2009

The curious/furious case of ArrayOfString class

If you happened to have a problem with Visual Studio generating an ArrayOfString class instead of simple string[] in your web service client proxy, then this might be useful:
You are getting the ArrayOfString in the client, because you are using Add Service Reference to add a reference to the asmx service. You can get the string[] in the client in one of two ways: a) by creating a WCF service instead of an ASMX service, and using Add Service Reference. b) by keeping the asmx service, and using Add Web Reference instead of Add Service Reference.
from: found through: If you are creating your web service client proxy in a separate class library project, (which you are forced to if you are using Web Site instead of Web Application and want to extend your proxy generated classes using partial classes), you have to make this a .NET Framework 2.0 project. Otherwise you won't even find the "Add Web Reference" option in the right-click menu, only "Add Service Reference".