' Sample script for PocketSOAP for working with arrays
'

dim e, n
set e = CreateObject("PocketSOAP.Envelope.2")

' this is how you tell pocketSOAP to serialize the request using
' the 1999 schema version instead of the 2001 one
'e.SerializerFactory.PrimarySchema = "http://www.w3.org/1999/XMLSchema"

' as VBScript only handles arrays of variants, we set the SerializerFactory
' to scriptingMode, this uses a scripting compatible set of serializers
' so that arrays of ints in soap still end up as arrays of variants in VBScript
const scfScripting = 1
e.SerializerFactory.SetConfig ( scfScripting ) 

e.methodName = "doubler"
e.URI = "http://simon.fell.com/calc"
n = array(10,20,30,40,50)
e.Parameters.Create "nums", n 

x =  e.serialize
wscript.echo "Request Length: " & len(x) & vbCRLF & x

dim t, r
set t = CreateObject("PocketSOAP.HTTPTransport.2")
t.Send "http://soap.4s4c.com/ssss4c/soap.asp", x 
e.parse t

wscript.echo vbCRLF & "Finished parsing response"
wscript.echo "Param count = " & e.Parameters.Count 

' dump the array contents !
dim arrRes
arrRes = e.Parameters.Item(0).Value
for idx = lbound(arrRes) to Ubound(arrRes)
	wscript.echo idx & " = " & arrRes(idx)
next

set e = nothing

