Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using array of complex types response in ASP/VB Script

126 views
Skip to first unread message

Lena Razov

unread,
May 1, 2003, 2:11:00 AM5/1/03
to

Hi,
I am trying to access from classic ASP using VB Script a webservice method
that returns
an array of complex types. Following is the relevent portion of the
WSDL. My code :

Set svc = Server.CreateObject("MSSOAP.SoapClient30")
svc.MSSoapInit( ...... )

results = svc.getRelatedDocuments(docId)

Response.Write "Numbers of elements in array: " & UBound(results) + 1 '
causes Subscript out of range error


How should I handle this in ASP/VB Script which supports only variants?
Is there a problem in receiving complex types (array of strings in my case)
through SOAP in VB Script client program?


--- Snipet from WSDL: ----

<wsdl:types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType name="ArrayOf_xsd_string">
- <complexContent>
- <restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]" />
</restriction>
</complexContent>
</complexType>
</schema>
</wsdl:types>

- <wsdl:message name="getRelatedDocumentsRequest">
<wsdl:part name="in0" type="xsd:string" />
</wsdl:message>

- <wsdl:message name="getRelatedDocumentsResponse">
<wsdl:part name="getRelatedDocumentsReturn" type="intf:ArrayOf_xsd_string"
/>
</wsdl:message>


--- end snipet ---

Thanks,

Lena


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.476 / Virus Database: 273 - Release Date: 24/04/03


Jason

unread,
May 1, 2003, 6:23:39 PM5/1/03
to
Are you referring to the WSML or client WSML in MSSoapInit?

"Lena Razov" <lra...@nospam.flexsoft.com.au> wrote in message
news:10517693...@shorty.flexsoft.com.au...

Lena Razov

unread,
May 1, 2003, 6:46:09 PM5/1/03
to
I'm refering to the WSDL file on server

svc.MSSoapInit ("http://localhost:4804/services/InfoWrangler?wsdl")

Am I doing anything wrong? I'm a newbie to SOAP TK 3.0.

Thanks,

Lena

"Jason" <ja...@nospam.com> wrote in message
news:ennJl$CEDHA...@TK2MSFTNGP11.phx.gbl...

Jerry Boggess

unread,
May 2, 2003, 10:25:29 AM5/2/03
to
When working with complex types it may be quicker just to pull the data
into a DOM and parse it out. When working with the DOM and VBScript you
may need to write a small DLL for your server with a sole purpose to
call the VB DoEvents command until the document is completely loaded.


Here is an example:
*********************************************
<%@ LANGUAGE=VBScript %>
<%
Option Explicit
'On Error Resume Next
Dim i ' Loop counter
Dim lngReturn
dim intDone
dim doEvent ' Call a small DLL whose entire purpose is to return
control to
' the OS mementarily using a VB DoEvents method.
Dim xNodeList ' IXMLDOMNodeList
Dim xNode ' IXMLDOMNode
Dim xDom ' DomDocument
' Any of the next five set statements will work. I have the latest DOM
4.0
' installed on my server.
' Set xDom = CreateObject("Microsoft.XMLDom") ' Version 1.0
' Set xDom = CreateObject("Msxml2.DOMDocument") ' Version 2.0
' Set xDom = CreateObject("Msxml2.DOMDocument.2.6") ' Version 2.6
Set xDom = CreateObject("Msxml2.DOMDocument.3.0") ' Version 3.0
' Set xDom = CreateObject("Msxml2.DOMDocument.4.0") ' Version 4.0
xDom.async = False
Set doEvent = CreateObject("prjDoEvents.basDoEvents")
intDone = 0
' This will return information for three companies, Microsoft, Intel,
and Apple.
lngReturn =
xDom.Load("http://www.xignite.com/xsecurity.asmx/LookupStock?Name=msft
intc aapl")

If lngReturn = True Then
Do Until xDom.readystate = 4
lngReturn = doEvent.DoEvents_Now ' << Calls DoEvents in a DLL
Loop
End If

' This should grab all child elements of the ArrayOfLookupItem
parent element
' Version 4.0 of the XML parser gave me some grief with this XPath
statement
' in VBScript. The same statement worked fine in Visual Basic.
With that said
' I switched back to using version 3.0 of the parser. Version 4.0
does work, just
' not with this particular XPath statement.
Set xNodeList = xDom.selectNodes("/ArrayOfLookupItem/*")
For Each xNode In xNodeList
' Write you HTML output here for parent nodes
Response.write "NodeName: " & xNode.nodeName & "<br>"
If xNode.hasChildNodes Then
For i = 0 To xNode.childNodes.length - 1
' Write your HTML output here for child nodes
Response.write "--ChildNode: " & xNode.childNodes(i).nodeName &
"=" & xNode.childNodes(i).Text & "<br>"
Next ' Node
End If
Next ' NodeList
%>
***************************************************


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jason

unread,
May 2, 2003, 8:52:49 PM5/2/03
to
You can either "deal with the data yourself", as was suggested via DOM, or
you have to use a WSML file to map the information to the appropriate COM
library on the client end.

"Lena Razov" <lra...@nospam.flexsoft.com.au> wrote in message

news:10518290...@shorty.flexsoft.com.au...

0 new messages