' Create a new envelope object, this is the core part of any pocketSOAP usage. dim env set env = CreateObject("pocketSOAP.Envelope.11") ' set the methodName and methodname Namespace values env.SetMethod "getQuote", "urn:xmethods-delayed-quotes" ' create the parameter, we'll ask for a quote for Salesforce.com [their ticker is CRM] env.Parameters.Create "symbol", "CRM" ' now, we need to send the SOAP request to the endpoint, so we create a transport object dim http set http = CreateObject("pocketSOAP.HTTPTransport") ' we need to set the SOAPAction header http.SOAPAction = "urn:xmethods-delayed-quotes#getQuote" ' now we send the request, this takes the envelope object we've been working with ' and serializes it out over the HTTP request http.Send "http://188.8.131.52:9090/soap", env ' now, we need to parse the SOAP message we get as a response env.parse http ' and now, extract the return value wscript.echo "Quote for CRM = " & env.Parameters.Item(0).ValueRunning this code generates this output [obviously the actual value will be different when you run it !]
Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. Quote for CRM = 18.39Congratulations, you've just writen your first SOAP client, and not a single angle bracket in sight! Simple eh ?, no messing around with XML, all the grungy stuff is safely hidden away !
http.SetProxy "localhost", 8080Re-running the script should give the same results, but now you'll see that proxyTrace has an item in the left hand list view. Click on the item in the list, the right hand view will change to show the request [at the top], and the response [at the bottom]
Copyright © Simon Fell, 2000-2004. All rights reserved.