• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

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
0
watsocd
Asked:
watsocd
  • 3
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
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 ?
0
 
watsocdAuthor Commented:
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)
'***********************************************
0
 
watsocdAuthor Commented:
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
0
 
watsocdAuthor Commented:
Please PAQ and refund. I answered my own question.
0
 
DarthModCommented:
PAQed with points refunded (500)

DarthMod
Community Support Moderator
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now