HRESULT CreateProxy([in] BSTR endpointURL, [in, defaultvalue("")] VARIANT methodNameURI, [in, defaultvalue("$uri#$method")] VARIANT SOAPActionPattern, [in, defaultvalue("")] VARIANT transport, [out, retval] IDispatch ** Proxy);
This creates a new proxy object, based on the parameters. Once created calls to the proxy object are automatically translated into SOAP calls. the expandable parts of the SOAPAction pattern are $url the SOAP endpoint URL $uri the methodname URI $method the name of the method being called
An IDispatch interface pointer to the newly created proxy object is returned.
Dim pf As Object, sp As Object
Set pf = CreateObject("pocketsoap.Factory")
' a simple proxy configuration
Set sp = pf.CreateProxy("http://services.xmethods.net/soap", "urn:xmethods-delayed-quotes")
Msgbox sp.getQuote(symbol:="INTC")
' getQuote becomes the methodName in the SOAP request, and it will have a single parameter "symbol" with the value "INTC"
' the result of the SOAP call is passed back as the result of the method, and so the quote value for INTC gets displayed in the message box
' this uses a SOAPAction pattern, to generate the correct SOAPAction for different methods
' you will have to check the document for the server you are calling to work out the correct pattern.
set sp = pf.CreateProxy("http://example.org/", "http://soap.example.org/", "$uri$method"
' this generates a SOAPAction header of http://soap.example.org/getQuote
sp.getQuote(ticker:="MSFT")
' this generates a SOAPAction header of http://soap.example.org/buyStock
sp.buyStock(ticker:="MSFT", shares:=200)
' use a preconfigured transport object, instead of the default
dim t
set t = CreateObject("pocketSOAP.HTTPTransport.2")
t.SetProxy "proxy.domain.com", 8080
t.ProxyAuthentication "simon", "password"
Set sp = pf.CreateProxy("http://services.xmethods.net/soap", "urn:xmethods-delayed-quotes", "", t)
' this call goes through the configured transport object, and so uses the authenticated proxy server.
Msgbox sp.getQuote(symbol:="INTC")
Copyright © Simon Fell, 2000-2004. All rights reserved.