HTTP Transport
The HTTP transport object includes many useful features, here's a run down on what it does, and how you use it.
Proxy Server Support
The HTTP transport supports sending requires via a proxy server, it also supports authenticating proxy servers, where you need
to supply a username & password for the proxy server to accept your request.
By default the HTTP transport object will attempt to make a direct connection to the server, call the SetProxy method to tell it to
use a proxy server instead. If you also need to authenticate with the proxy server, call ProxyAuthentication.
dim http
set http = CreateObject("pocketSOAP.HTTPTransport.2")
' name of the proxy server and port, note that the name shouldn't have a preceeding http://
http.SetProxy "proxy.mydomain.com", 7070
' authentication info for proxy server
http.ProxyAuthentication "myUserName","MyPassword"
....
Basic Authentication
The HTTP transport supports servers that require authentication using the basic authentication protocol. Simply call the Authentication method
before calling send, specifying the username and password to use.
dim http
set http = CreateObject("pocketSOAP.HTTPTransport.2")
http.Authentication "MyUserName", "MyPassword"
http.Send "http://soap.example.org/", e.serialize
...
SSL
The HTTP transport supports SSL connections, simply use a https:// url as the endpoint rather than the normal http://
dim http
set http = CreateObject("pocketSOAP.HTTPTransport.2")
http.send "https://soap.example.org/" e.serialize
Timeouts
By default the HTTP transport uses a 15 second timeout for sends and receives, this can be altered via the TimeOut property as needed.
Session Cookies
Non persistent cookies are automatically supported by the transport, and are tied to a particular instance of the transport. If you are calling
an endpoint that requires you to round trip session cookies, simply re-use the same instance of the transport object.
dim http
set http = CreateObject("pocketSOAP.HTTPTransport.2")
' build a login SOAP request, and send it via this instance of the transport object.
' the server returns a cookie, which the transport object remembers
SendLoginRequest "Username", "password", http
' build a quote request, and send it via this isntance of the transport object
' the previous received cookie will be automatically sent to the server, maintaining the server based session setup earlier
SendQuoteRequest "INTC", http
Redirects
The transport object can automatically follow redirects set by the server, until a certain redirect depth is reached [the default is 5]. You
can change this by altering the MaxRedirectDepth property. However for security reasons this is disabled by default, to enable this
feature call the Option method to turn on the "redirects.onpost" option.
Compression
By default the outgoing request will be uncompressed, and there will be a HTTP header that indicates
that we can handle a compressed response. If the server supports compressed requests, then you can
enable compression of the outgoing request by setting the compression.enabled named option
to true ( e.g. t.option("compression.enabled") = true ) before calling t.send.
Copyright
Copyright © Simon Fell, 2000-2004. All rights reserved.