vba - Can Generic Type Mapper (MSSOAP toolkit) be persuaded to handle empty arrays -
i'm having problem described here:
i consuming web service
using office 2003 web services toolkit
. generates classes data returned web service: 1 of classes has property array may empty.
when call web service, generic type mapper raises error:
array dimensions not match definition
does know of solution problem allows me keep using generated classes (i know consume raw xml)?
since there no takers, i'll describe i've done date in case else has similar issue.
on client (using office 2003 web services toolkit) want receive collection of objects have property collection of objects. example, collection of customer objects c# web service customer class looks like:
public class customer { public string name { get; set; } public collection<address> addresses { get; } }
the problem have addresses property can empty collection, , soap30 generictypemapper not able handle this.
in specific case, client did not need collection of addresses, want able other properties of customer class. don't care what's in "addresses" variant property that's created web services toolkit.
what i've done create vb6 activex dll class minimalist implementation of isoapmapper returns uninitialized object reference:
implements isoaptypemapper private function isoaptypemapper_iid() string end function private sub isoaptypemapper_init(byval par_factory msosoaplib30.isoaptypemapperfactory, byval par_schema msxml2.ixmldomnode, byval par_wsmlnode msxml2.ixmldomnode, byval par_xsdtype msosoaplib30.enxsdtype) end sub private function isoaptypemapper_read(byval par_soapreader msosoaplib30.isoapreader, byval par_node msxml2.ixmldomnode, byval par_encoding string, byval par_encodingmode msosoaplib30.enencodingstyle, byval par_flags long) variant set isoaptypemapper_read = nothing end function private function isoaptypemapper_schemanode() msxml2.ixmldomnode set isoaptypemapper_schemanode = nothing end function private function isoaptypemapper_vartype() long isoaptypemapper_vartype = vbobject end function private sub isoaptypemapper_write(byval par_isoapserializer msosoaplib30.isoapserializer, byval par_encoding string, byval par_encodingmode msosoaplib30.enencodingstyle, byval par_flags long, par_var variant) end sub private function isoaptypemapper_xsdtype() msosoaplib30.enxsdtype isoaptypemapper_xsdtype = enxsdundefined end function
then modified wsml generated web services toolkit use implementation appropriate property:
dim str_wsml string str_wsml = "<servicemapping>" str_wsml = str_wsml & "<service name='myservice'>" str_wsml = str_wsml & "<using progid='msosoap.genericcustomtypemapper30' cachable='0' id='gctm'/>" str_wsml = str_wsml & "<using progid='soaphelper.emptyarraymapper' cachable='0' id='eatm'/>" ' <== added line str_wsml = str_wsml & "<types>" ... str_wsml = str_wsml & "<type name='arrayofaddress' targetnamespace='http://...' uses='eatm' targetclassname='struct_address'/>" '<== added line str_wsml = str_wsml & "<type name='address' targetnamespace='http://mynamespace.com/myapp/services/data' uses='gctm' targetclassname='struct_address'/>" ...
this achieved needed application.
it seems me may possible achieve support empty arrays more implementing isoapmapper in such way that:
it detects , handles case of empty array.
or if array non-empty delegates standard generictypemapper.
i'd still interested hear if has solved general problem. possibly not soap client obsolete , no longer supported microsoft.
Comments
Post a Comment