views:

982

answers:

2

I am converting a SOAP toolkit 3 Vb web service to a .Net web service. I have a requirement where in I want to pass a two dimensional variant array to vb client. I tried the following

1. I looked into the xml produced by the SOAP toolkit 3 for the vb web serive and tried to produce the exact same xml as vb produced in the .Net web service. For some reason Vb did not understand this.

2. I thought of converting the 2 - d array to a single dim array and then convert it back to a 2 d array in the client side. The problem here is the I can pass string[] to vb but not object[]. I need a variant array in vb.

Any suggestions... Jai

A: 

It sounds to me like you want to pass an array of objects to a VB6 function? A parameter of type variant will accept an array of objects. Assume Class1 is a class with a property of type integer named "SomeProperty":

Private Sub Form_Load()

  Dim arrayOfObjects(3, 3) As New Class1

  arrayOfObjects(0, 0).SomeProperty = 0
  arrayOfObjects(1, 1).SomeProperty = 1
  arrayOfObjects(2, 2).SomeProperty = 2

  foo arrayOfObjects()


End Sub

Private Function foo(incomingArray As Variant)

  Debug.Print incomingArray(0, 0).SomeProperty
  Debug.Print incomingArray(1, 1).SomeProperty
  Debug.Print incomingArray(2, 2).SomeProperty

End Function
raven
What does a Variant look like in a schema?
John Saunders
@John Saunders: I don't understand your question.
raven
@raven: how does a Variant serialize to XML from the SOAP Toolkit? In particular, can you show the piece of XML Schema the defines a Variant?
John Saunders
A: 

Did the following to resolve this issue

Returned a jagged array of objects from the web service. Web service support jagged array but not multi dimensional array as return type. In the client side added .Net client which converts the jagged array of objects back to the two dimensional array to the vb client.

VB client receives this as two dimensional array of variant.

Thanks, Jai