IProxyFactory::CreateProxy Method

HRESULT CreateProxy([in] BSTR endpointURL, [in, defaultvalue("")] VARIANT methodNameURI, [in, defaultvalue("$uri#$method")] VARIANT SOAPActionPattern, [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

 

Parameters

endpointURL
BSTR, [in]: This is the URL of the SOAP server to call.
methodNameURI
VARIANT, [in, defaultvalue("")]: This is the namespace URI for the methodName element [the actual method name is populated by the resulting proxy object based on the name of the method called against it.
SOAPActionPattern
VARIANT, [in, defaultvalue("$uri#$method")]: This is either a direct string value that represents the value for the SOAPAction header, or if the SOAPAction header is defined in terms of other parameters [as is the case for many SOAP servers], you can specify the a pattern for the SOAPAction and the proxy will expand the pattern into the SOAPAction for each call.
Proxy
IDispatch **, [out, retval]: The resulting SOAP Proxy object.

 

Return Values

An IDispatch interface pointer to the newly created proxy object is returned.

 

Sample Code

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)

 

See Also

The IProxyFactory Interface | 

 

 

Copyright

Copyright © Simon Fell, 2000-2004. All rights reserved.