'
' Basic Inter-op test script for pocketSOAP
'

Test4s4c
Test4s4c2
TestGlue
TestRope
TestApache
TestSoapLite

Function Test4s4c()
	dim soap, t
	set soap = CreateObject("PocketSOAP.Envelope.2")

	soap.methodName = "Add"
	soap.URI = "http://simon.fell.com/calc"

	soap.Parameters.Create "a", 100
	soap.Parameters.Create "b", 20

	set t = CreateObject("PocketSOAP.HTTPTransport.2")
	t.Send "http://soap.4s4c.com/ssss4c/soap.asp", soap.serialize
	soap.parse t

	' or just go for the one we want
	wscript.echo "4s4c at www.4s4c.com result (expecting 120) : " & soap.Parameters.ItemByName("added").Value
end Function

Function Test4s4c2()
	dim soap, t
	set soap = CreateObject("PocketSOAP.Envelope.2")

	soap.methodName = "Concat"
	soap.URI = "http://simon.fell.com/strings"

	soap.Parameters.Create "chunks", array("one","two","three","four")

	set t = CreateObject("PocketSOAP.HTTPTransport.2")
	t.Send "http://soap.4s4c.com/ssss4c/soap.asp", soap.serialize
	soap.parse t

	' or just go for the one we want
	wscript.echo "4s4c at www.4s4c.com result (onetwothreefour) : " & soap.Parameters.Item(0).Value
end Function

Function TestGlue()
	dim soap, t
	set soap = CreateObject("PocketSOAP.Envelope.2")
	set t = CreateObject("PocketSOAP.HTTPTransport.2")

	soap.methodName = "getQuote"
	soap.URI = "urn:xmethods-delayed-quotes"

	soap.Parameters.Create "symbol", "AMD"

	t.soapAction = ""
	t.Send "http://services.xmethods.net/soap", soap.serialize
	soap.parse t

	' or just go for the one we want
	wscript.echo "GLUE at services.xmethods.com result (Stock Quote for AMD) : " & soap.Parameters.Item(0).Value
end Function

Function TestApache()
	dim soap, t
	set soap = CreateObject("PocketSOAP.Envelope.2")
	set t = CreateObject("PocketSOAP.HTTPTransport.2")

	soap.methodName = "getTemp"
	soap.URI = "urn:xmethods-Temperature"

	soap.Parameters.Create "zipcode", "94107"
	t.SOAPAction = ""
	t.Send "http://services.xmethods.net/soap/servlet/rpcrouter", soap.serialize
	soap.parse t

	' or just go for the one we want
	wscript.echo "Apache at services.xmethods.com result (Current temp. in San Francisco) : " & soap.Parameters.ItemByName("return").Value
end Function

Function TestSoapLite()
	dim soap, t
	set soap = CreateObject("PocketSOAP.Envelope.2")
	set t = CreateObject("PocketSOAP.HTTPTransport.2")

	soap.methodName = "BabelFish"
	soap.URI = "urn:xmethodsBabelFish"

	soap.Parameters.Create "translationmode", "en_de"
	soap.Parameters.Create "sourcedata", "babel fish in German"

	t.soapAction = "urn:xmethodsBabelFish#BabelFish"
	t.Send "http://services.xmethods.net/perl/soaplite.cgi", soap.serialize
	soap.parse t

	' or just go for the one we want
	wscript.echo "Soap::Lite at www.xmethods.com result (babel fish in German) : " & soap.Parameters.Item(0).Value
end Function

Function TestRope()
	dim x, soap, t
	set soap = CreateObject("PocketSOAP.Envelope.2")
	set t = CreateObject("PocketSOAP.HTTPTransport.2")

	soap.methodName = "GetServerTime"
	soap.URI = "urn:Foo"

	t.Send "http://www.soaptoolkit.com/soapdemo/services.asp", soap.serialize
	soap.parse t

	' or just go for the one we want
	wscript.echo "ROPE at www.soaptoolkit.com result (expecting current date/time) : " & soap.Parameters.Item(0).Value
end Function
