1
votes

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
1
VBScript is scripting language, as such it's not possible to perform type casting so the problem might be more severe than you think. First, let's debug this: when you have Response.Write(result2) what you get? What about Response.Write(CStr(result2))? And finally Response.Write(TypeName(result2))? Please let us know the output of each and it might shed some light on the problem.Shadow Wizard Wearing Mask V2
+1 Shadow Wizard. I guess the type name is 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's classic-asp, your web service returns a delimited string instead of array of string. And you could split returned value in classic asp, so it's iterable.Kul-Tigin
Hey guys, thanks for your responses, I will be looking at this in about an hour and will report my progress.David

1 Answers

1
votes

Have you tried using the word SET, since this is returning an object?

SET result2 = soap.getProductFunctions("AEDO")