Link to home
Start Free TrialLog in
Avatar of watsocd
watsocd

asked on

Access a variant array of objects

I am working with web services and SOAP. I am trying to get my get my web service to return a complex type (an array).

Here is my simplified code:
'***********************************************
DIM myvar as variant

If IsEmpty(temp) Then MsgBox "EMPTY"

myvar=MyWebServiceCall  'This is a function that returns an array of some type

If IsArray(temp) Then MsgBox "array"
MsgBox TypeName(temp)

MsgBox UBound(myvar)
'***********************************************

I get the first msgbox indicating that myvar is empty.
I get the second msgbox indicating that myvar contains an array.
I get the third msgbox indicating: Object()

The program crashes on the last msgbox with a "Subscript out of range" error.

myvar should contain an array of objects that are of a userdefined type.

How do I get access to the array inside myvar?

Chuck
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

You're code is a little confusing. Where does "temp" come into all of this ? You are checking that "temp" is an array, but you are trying to treat "myvar" as an array, so where does "temp" come from ?
Avatar of watsocd
watsocd

ASKER

Sorry, I copied the code out of my original. The temp variable should be myvar.

Here is my corrected code:
'***********************************************
DIM myvar as variant

If IsEmpty(myvar) Then MsgBox "EMPTY"

myvar=MyWebServiceCall()  'This is a function that returns an array of some type

If IsArray(myvar) Then MsgBox "array"
MsgBox TypeName(myvar)

MsgBox UBound(myvar)
'***********************************************
Avatar of watsocd

ASKER

I am going to requres this question be deleted.

The problem was with the server, not the client.

I used proxyTrace to determine this by looking at the raw XML SOAP package.

Chuck
Avatar of watsocd

ASKER

Please PAQ and refund. I answered my own question.
ASKER CERTIFIED SOLUTION
Avatar of DarthMod
DarthMod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial