I’m having the problem described here:
I am consuming a Web Service using Office 2003 Web Services Toolkit. This generates classes for all the data returned by my web service: one of the classes has a property that is an array which may be empty.
When I call the web service, the Generic Type Mapper raises an error:
array dimensions do not match definition
Does anyone know of a solution to this problem that allows me to keep using the generated classes (I know I could just consume the raw XML)?
Since there are no takers, I’ll describe what I’ve done to date in case anyone else has a similar issue.
On my client (using Office 2003 Web Services Toolkit) I want to receive a collection of objects which have a property that itself is a collection of objects. For example, a collection of Customer objects from a C# web service where the Customer class looks something like:
The problem I have is that the Addresses property can sometimes be an empty collection, and the SOAP30 GenericTypeMapper is not able to handle this.
In my specific case, the client did not actually need the collection of addresses, I just want to be able to get the other properties of the Customer class. So I don’t really care what’s in the ‘Addresses’ variant property that’s created by the Web Services Toolkit.
What I’ve done is create a VB6 ActiveX DLL with a class with a minimalist implementation of ISoapMapper that always returns an uninitialized object reference:
Then I modified the WSML generated by the Web Services Toolkit to use this implementation for the appropriate property:
This achieved what I needed for this application.
It seems to me that it may be possible to achieve support for empty arrays more generally by implementing ISoapMapper in such a way that:
It detects and handles the case of an empty array.
Or if the array is non-empty it delegates to the standard GenericTypeMapper.
I’d still be interested to hear if anyone has solved the general problem. Possibly not as the SOAP client is obsolete and no longer supported by Microsoft.