Using SSL with WinInet is a minor issue. The parameters are slightly different for the Internet Connection and the Internet Request.
The following code illustrates the parameters that are created for SSL:
'Open Connection hInternetConnect = InternetConnect(hInternetSession, URL, INTERNET_DEFAULT_HTTPS_PORT, _ vbNullString, vbNullString, INTERNET_SERVICE_HTTP, 0, 0)
If hInternetConnect > 0 Then sOptionBuffer = sBuffer
lOptionBufferLen = Len(sOptionBuffer)
hHttpOpenRequest = HttpOpenRequest(hInternetConnect, "POST", URLObject, "HTTP/1.0", vbNullString, 0, _ INTERNET_FLAG_RELOAD Or INTERNET_FLAG_MULTIPART Or INTERNET_FLAG_SECURE Or INTERNET_FLAG_IGNORE_CERT_CN_INVALID Or INTERNET_FLAG_IGNORE_CERT_DATE_INVALID, 0) |
Here is the completed source code of the class XmlTransmitter, which handles reading XML request file, sending the request to UPS Online Tool server, and writing the XML response to a file. This class uses MSXML3, SDK, and "WinInet".
If you already have an XML request file and want to have the XML response write to a file, you can run XmlTransmitter <service><configuration filename><xml request filename><xml response filename>. The configuration file sets the server's host name and connection protocol. A sample configuration file is here. Please modify the values based on your application.
Copyright � 2006 United Parcel Service of America, Inc.