I don't normally deal with VBScript and classic ASP but I have to make some changes to one of our old sites.
I use a SOAP Web Service to get an array of string values, but when I try to consume it from within the classic ASP code it tells me it's an object
The service works, it returns an array of strings, the code is sound, I just need to know how to change it from an object to string I think.
The web service WSDL:
<xs:element name="getProductFunctionsResponse">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Error
Object not a collection
Classic ASP code:
result2 = soap.getProductFunctions("AEDO")
i = 0
For Each present In result2
If mid(user_auth_key,i,1) = 1 Then
response.write("success")
End If
response.write(present)
response.write("<br />")
i = i+1
Next
asked Sep 14, 2011 at 14:10
David
4,0178 gold badges34 silver badges49 bronze badges
1 Answer 1
Have you tried using the word SET, since this is returning an object?
SET result2 = soap.getProductFunctions("AEDO")
answered Sep 29, 2011 at 21:19
Bob Johnson
1012 silver badges6 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-vb
Response.Write(result2)what you get? What aboutResponse.Write(CStr(result2))? And finallyResponse.Write(TypeName(result2))? Please let us know the output of each and it might shed some light on the problem.String()and VBScript cannot handle it. (if I'm not wrong) @David You could add one more optional parameter for backward compatibility to your web service. If it'sclassic-asp, your web service returns a delimited string instead ofarray of string. And you could split returned value in classic asp, so it's iterable.