Question

VBA Detect Proxy Settings

Asked by: CyberUnDead

What is the best way to detect proxy settings using VBA?
1. direct (no proxy)
2. manual
3. auto proxy

I am using Microsoft SOAP Toolkit 3 (MSSOAP30.dll) to call a web service in Microsoft Access.  This works great when the user has direct internet access but fails when

1.  Manual Proxy is defined
2.  Automatically Detect Proxy

Through Google I came across this link http://www.tech-archive.net/Archive/VB/microsoft.public.vb.winapi.networks/2004-11/0005.html which is code by Stephen Sulzer to a forum.  I was able to adapt the code to retrieve manual settings but not for automatic.  

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-09-02 at 07:31:31ID24701422
Tags

vba

,

visual basic

,

SOAP toolkit

Topics

Visual Basic Programming

,

SOAP

,

Microsoft Access Database

Participating Experts
2
Points
500
Comments
19

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. How to set proxy setting for MS SOAP
    I am trying to use MS SOAP Toolkit 2.0 in Visual C++ to call a remote SOAP web Service. The client works perfectly from a direct connection but fails when I am working from behind a proxy/firewall. How do I set the proxy settings for this to work? Regards, Saradhi.
  2. How to use the Microsoft Office Soap Type Library v3.0 …
    I have some VBA code within XL that calls the Microsoft Office Soap Type Library v3.0, but my PC doesn't have it (in XL I can see msg "MISSING: Microsoft Office Soap Type Library v3.0"). My PC uses Office XP, which comes with an older versio of the Soap Type lib. My...
  3. View SOAP message sent by SOAP Toolkit 3.0 to https …
    Hi There, I will be using SOAP Toolkit 3.0 in VB6 to connect to a web service that has a server certificate (SSL), and I am connecting to the server via a proxy on my end. Is there any way to view the SOAP message that is being sent? I dont believe that I can use the Trace...
  4. SOAP Toolkit for ACCESS 2007
    Hi all, Can I use the SOAP toolkit 3,0 in ACCESS 2007 or is there another way to do it? I found this code using the XMLHTTP40 object from the SOAP Toolkit in EE. It is what I need to send an XML file and receive the response from the server (correct me if I'm wrong) Set mo...
  5. SOAP - Using VBA to send XML to WSDL
    Hallo, I would like to send a XML (subscribe.xml - see below) file to a WSDL using VBA in ACCESS 2007. An username and password must be used The WSDL replies with a XML file (see below) Can you help me create this code? Thanks, Marion Username = "Username" Passwo...
  6. MS SOAP Toolkit 3.0: Saving before sending
    I haven't seen a simple example on how to save a copy before sending the soap message using the low API of ms soap toolkit 3.0 (httpconnector30, soapserializer30 and soapreader30). I'm guessing the problem is that I'm not familiar with win32 istreams in general Could anyon...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: egl1044Posted on 2009-09-02 at 07:53:40ID: 25241676

How to programmatically query and set proxy settings under Internet Explorer
http://support.microsoft.com/default.aspx?scid=kb;en-us;226473

 

by: puppydogbuddyPosted on 2009-09-02 at 08:47:33ID: 25242321

From what  can determine, a standard auto-detect protocol has not been fully implemented yet, altough wpad.dat is widely used.  Therefore, the auto-detect method is probably not feasible at this point in time.  See these links:
              http://msdn.microsoft.com/en-us/library/03seed2h(VS.71).aspx
              http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol  

 

by: CyberUnDeadPosted on 2009-09-03 at 08:03:00ID: 25251403

Below is the VBA Proxy Module code that I referred to.

Option Compare Database
Option Explicit
 
'Stephen Sulzer
'11/02/2004
'http://www.tech-archive.net/Archive/VB/microsoft.public.vb.winapi.networks/2004-11/0005.html
'Usage: GetProxyInfoForUrl("http://www.google.com")
 
' My app proxy information type
Public Type ProxyInfo
   active As Boolean
   proxy As String
   proxyBypass As String
End Type
 
' Structure to receive IE proxy settings
Private Type WINHTTP_CURRENT_USER_IE_PROXY_CONFIG
   fAutoDetect As Long
   lpszAutoConfigURL As Long
   lpszProxy As Long
   lpszProxyByPass As Long
End Type
 
' Need CopyMemory to copy BSTR pointers around
Private Declare Sub CopyMemory Lib "kernel32" _
         Alias "RtlMoveMemory" (ByVal lpDest As Long, _
         ByVal lpSource As Long, ByVal cbCopy As Long)
 
' SysAllocString creates a UNICODE BSTR string based on a UNICODE string
Private Declare Function SysAllocString Lib "oleaut32" (ByVal pwsz As Long) As Long
 
' Need GlobalFree to free the pointers in the CURRENT_USER_IE_PROXY_CONFIG
' structure returned from WinHttpGetIEProxyConfigForCurrentUser,
' per the documentation
Private Declare Function GlobalFree Lib "kernel32" (ByVal p As Long) As Long
 
' WinHttpGetIEProxyConfigForCurrentUser declaration
Private Declare Function WinHttpGetIEProxyConfigForCurrentUser _
   Lib "WinHTTP.dll" _
   (ByRef proxyConfig As WINHTTP_CURRENT_USER_IE_PROXY_CONFIG) As Long
 
Private Type WINHTTP_AUTOPROXY_OPTIONS
   dwFlags As Long
   dwAutoDetectFlags As Long
   lpszAutoConfigURL As Long
   lpvReserved As Long
   dwReserved As Long
   fAutoLogonIfChallenged As Long
End Type
 
Private Type WINHTTP_PROXY_INFO
   dwAccessType As Long
   lpszProxy As Long
   lpszProxyByPass As Long
End Type
 
' Constants for dwFlags of WINHTTP_AUTOPROXY_OPTIONS
Const WINHTTP_AUTOPROXY_AUTO_DETECT = 1
Const WINHTTP_AUTOPROXY_CONFIG_URL = 2
 
' Constants for dwAutoDetectFlags
Const WINHTTP_AUTO_DETECT_TYPE_DHCP = 1
Const WINHTTP_AUTO_DETECT_TYPE_DNS = 2
 
Private Declare Function WinHttpGetProxyForUrl Lib "WinHTTP.dll" _
   (ByVal hSession As Long, _
    ByVal pszUrl As Long, _
    ByRef pAutoProxyOptions As WINHTTP_AUTOPROXY_OPTIONS, _
    ByRef pProxyInfo As WINHTTP_PROXY_INFO) As Long
 
Private Declare Function WinHttpOpen Lib "WinHTTP.dll" _
   (ByVal pszUserAgent As Long, _
    ByVal dwAccessType As Long, _
    ByVal pszProxyName As Long, _
    ByVal pszProxyBypass As Long, _
    ByVal dwFlags As Long) As Long
 
Private Declare Function WinHttpCloseHandle Lib "WinHTTP.dll" _
   (ByVal hInternet As Long) As Long
 
Public Function GetProxyInfoForUrl(URL As String) As ProxyInfo
 
   Dim IEProxyConfig As WINHTTP_CURRENT_USER_IE_PROXY_CONFIG
   Dim AutoProxyOptions As WINHTTP_AUTOPROXY_OPTIONS
   Dim WinHttpProxyInfo As WINHTTP_PROXY_INFO
   Dim ProxyInfo As ProxyInfo
   Dim fDoAutoProxy As Boolean
   Dim ProxyStringPtr As Long
   Dim ptr As Long
   Dim error As Long
 
   AutoProxyOptions.dwFlags = 0
   AutoProxyOptions.dwAutoDetectFlags = 0
   AutoProxyOptions.lpszAutoConfigURL = 0
   AutoProxyOptions.dwReserved = 0
   AutoProxyOptions.lpvReserved = 0
   AutoProxyOptions.fAutoLogonIfChallenged = 1
 
   IEProxyConfig.fAutoDetect = 0
   IEProxyConfig.lpszAutoConfigURL = 0
   IEProxyConfig.lpszProxy = 0
   IEProxyConfig.lpszProxyByPass = 0
 
   WinHttpProxyInfo.dwAccessType = 0
   WinHttpProxyInfo.lpszProxy = 0
   WinHttpProxyInfo.lpszProxyByPass = 0
 
   ProxyInfo.active = False
   ProxyInfo.proxy = vbNullString
   ProxyInfo.proxyBypass = vbNullString
 
   fDoAutoProxy = False
   ProxyStringPtr = 0
   ptr = 0
 
   ' Check IE's proxy configuration
   If (WinHttpGetIEProxyConfigForCurrentUser(IEProxyConfig) > 0) Then
       ' If IE is configured to auto-detect, then we will too.
       If (IEProxyConfig.fAutoDetect <> 0) Then
           AutoProxyOptions.dwFlags = WINHTTP_AUTOPROXY_AUTO_DETECT
           AutoProxyOptions.dwAutoDetectFlags = _
                       WINHTTP_AUTO_DETECT_TYPE_DHCP + _
                       WINHTTP_AUTO_DETECT_TYPE_DNS
           fDoAutoProxy = True
       End If
 
       ' If IE is configured to use an auto-config script, then
       ' we will use it too
       If (IEProxyConfig.lpszAutoConfigURL <> 0) Then
           AutoProxyOptions.dwFlags = AutoProxyOptions.dwFlags + _
                       WINHTTP_AUTOPROXY_CONFIG_URL
           AutoProxyOptions.lpszAutoConfigURL = IEProxyConfig.lpszAutoConfigURL
           fDoAutoProxy = True
       End If
   Else
       ' if the IE proxy config is not available, then
       ' we will try auto-detection
       AutoProxyOptions.dwFlags = WINHTTP_AUTOPROXY_AUTO_DETECT
       AutoProxyOptions.dwAutoDetectFlags = _
                       WINHTTP_AUTO_DETECT_TYPE_DHCP + _
                       WINHTTP_AUTO_DETECT_TYPE_DNS
       fDoAutoProxy = True
   End If
 
   If fDoAutoProxy Then
       Dim hSession As Long
 
       ' Need to create a temporary WinHttp session handle
       '  Note: performance of this GetProxyInfoForUrl function can be
       '   improved by saving this hSession handle across calls
       '   instead of creating a new handle each time
       hSession = WinHttpOpen(0, 1, 0, 0, 0)
 
       If (WinHttpGetProxyForUrl(hSession, StrPtr(URL), AutoProxyOptions, _
               WinHttpProxyInfo) > 0) Then
           ProxyStringPtr = WinHttpProxyInfo.lpszProxy
           ' ignore WinHttpProxyInfo.lpszProxyBypass, it will not be set
       Else
           error = Err.LastDllError
           ' some possibly autoproxy errors:
           '   12166 - error in proxy auto-config script code
           '   12167 - unable to download proxy auto-config script
           '   12180 - WPAD detection failed
       End If
 
       WinHttpCloseHandle (hSession)
   End If
 
   ' If we don't have a proxy server from WinHttpGetProxyForUrl,
   ' then pick one up from the IE proxy config (if given)
   If (ProxyStringPtr = 0) Then
       ProxyStringPtr = IEProxyConfig.lpszProxy
   End If
 
   ' If there's a proxy string, convert it to a Basic string
   If (ProxyStringPtr <> 0) Then
       ptr = SysAllocString(ProxyStringPtr)
       CopyMemory VarPtr(ProxyInfo.proxy), VarPtr(ptr), 4
       ProxyInfo.active = True
   End If
 
   ' Pick up any bypass string from the IEProxyConfig
   If (IEProxyConfig.lpszProxyByPass <> 0) Then
       ptr = SysAllocString(IEProxyConfig.lpszProxyByPass)
       CopyMemory VarPtr(ProxyInfo.proxyBypass), VarPtr(ptr), 4
   End If
 
   ' Free any strings received from WinHttp APIs
   If (IEProxyConfig.lpszAutoConfigURL <> 0) Then
       GlobalFree (IEProxyConfig.lpszAutoConfigURL)
   End If
   If (IEProxyConfig.lpszProxy <> 0) Then
       GlobalFree (IEProxyConfig.lpszProxy)
   End If
   If (IEProxyConfig.lpszProxyByPass <> 0) Then
       GlobalFree (IEProxyConfig.lpszProxyByPass)
   End If
   If (WinHttpProxyInfo.lpszProxy <> 0) Then
       GlobalFree (WinHttpProxyInfo.lpszProxy)
   End If
   If (WinHttpProxyInfo.lpszProxyByPass <> 0) Then
       GlobalFree (WinHttpProxyInfo.lpszProxyByPass)
   End If
 
   ' return the ProxyInfo struct
   GetProxyInfoForUrl = ProxyInfo
 
End Function

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:

Select allOpen in new window

 

by: CyberUnDeadPosted on 2009-09-03 at 08:09:31ID: 25251463

Below is the SOAP calling code:

Public Function CallWebService(Optional strClientId As String = "1") As String
    On Error GoTo Error_Handle
 
		Const URL As String = "http:\\localhost"
 
    Dim strSOAPResponse As String
    Dim strSOAPServiceURL As String
 
    'Requires Microsoft SOAP Toolkit 3
    Dim objSOAPClient As Object
    Set objSOAPClient = CreateObject("MSSOAP.SoapClient30")
 
    objSOAPClient.ClientProperty("ServerHTTPRequest") = True
    strSOAPServiceURL = URL & "CallWebService.cfc?wsdl"
    
    'Get Internet Explorer's Proxy Settings
    Dim proxyDetails As ProxyInfo
    proxyDetails = GetProxyInfoForUrl(strSOAPServiceURL)
    
    objSOAPClient.MSSoapInit strSOAPServiceURL
    
    'If using a proxy set objSOAPClient to use too.
    If proxyDetails.active Then
        objSOAPClient.ConnectorProperty("ProxyServer") = proxyDetails.proxy
    End If
    
    'Make SOAP Request
    strSOAPResponse = objSOAPClient.CallWebService(strClientId)
 
    'If empty error occurred
    If IsNull(strSOAPResponse) Or strSOAPResponse = vbNullString Then
        CallWebService = "ERROR"
    Else
        'Return String Response
        CallWebService = strSOAPResponse
    End If
 
    Set objSOAPClient = Nothing
    
Exit_Function:
    Exit Function
 
Error_Handle:
    Select Case Err.number
    Case 429:    'SOAP Toolkit 3 not installed
        Err.Clear
        MsgBox "Please install the Microsoft SOAP Toolkit 3.", vbInformation
      	Resume Exit_Function
    Case 5406, 438: 'If Web Service is unreachable or returns empty string
        Err.Clear
        Resume Next
    Case -2147352567: 'Web Service Error
        Err.number = GetLastError
        Resume Next
    Case Else:
        Resume Exit_Function
    End Select
End Function

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:

Select allOpen in new window

 

by: CyberUnDeadPosted on 2009-09-03 at 08:21:39ID: 25251610

The code works fine in all my scenarios in house.  But when deployed to the field  and stepping through the code I received an error on the statement:

objSOAPClient.ConnectorProperty("ProxyServer") = proxyDetails.proxy

Saying the objSOAPClient was not intialized.

Any ideas?

 

by: puppydogbuddyPosted on 2009-09-03 at 12:04:41ID: 25253837

usually that means you forgot to initialize one (or more) variables by using a set statement.
 Set objSOAPClient = ??

 

by: puppydogbuddyPosted on 2009-09-03 at 12:12:15ID: 25253907

were is set statement corresponding to line 22 of your code?

 

by: CyberUnDeadPosted on 2009-09-03 at 12:53:12ID: 25254303

puppydogbuddy

I am declaring my object in line #10 of that module and then the next line #11 I am using the set assignment:

 Set objSOAPClient = CreateObject("MSSOAP.SoapClient30")

 

by: puppydogbuddyPosted on 2009-09-03 at 14:43:37ID: 25255268

I saw the set statement on line 11, but variables can be (and often are) re-initialized to point to a property or value of the object.  If you read the comment in line 22, it seems to hint at resetting the object pointer (perhaps to an auto-detect proxy setting as indicated in the reference sources)

maybe somehing like this:
 'If using a proxy set objSOAPClient to use too.
    If proxyDetails.active Then
        objSOAPClient.ConnectorProperty("ProxyServer") = proxyDetails.proxy
   Else
        Set objSOAPClient = GET http://wpad/wpad.dat
   End If
     
               

 

by: CyberUnDeadPosted on 2009-09-12 at 19:29:44ID: 25318744

puppydogbuddy:

That code comment was created by me and is perhaps a misnomer as what it doing is assigning the proxy server (e.g. localhost:8080) to the ConenctorProperty("ProxyServer") for the objSOAPClient object (i.e. the SOAP client).

I am still digging around, unfortunately I had to deal with a couple other issues this past week thus my late reply.  

I came across this forum message: http://objectmix.com/xml-soap/87690-re-ms-soap-toolkit-3-proxy-server-issue.html.   Which indicates a different usage than I have seen before (see code block below for comparison).  

I hope to test this in field early next week.  I will report back my findings.

'Current Code:
objSOAPClient.ConnectorProperty("ProxyServer") = localhost:8080
 
'Code Listed in Real World XML Web Services for VB and VB.Net Developers
'Throws error on 2nd and 3rd line
objSOAPClient.ConnectorProperty("ProxyServer") = localhost
objSOAPClient.ConnectorProperty("ProxyPort") = 8080
objSOAPClient.ConnectorProperty("UseProxy") = True
 
'ObjectMix Post
objSOAPClient.ConnectorProperty("ProxyServer") = "<CURRENT_USER>"
objSOAPClient.ConnectorProperty("EnableAutoProxy") = True

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:

Select allOpen in new window

 

by: CyberUnDeadPosted on 2009-09-18 at 05:49:09ID: 25365353

The solution did not work as I am still getting errors on the

objSOAPClient.MSSoapInit strSOAPServiceURL

line despite having the Microsoft SOAP toolkit v3 installed.

 

by: puppydogbuddyPosted on 2009-09-18 at 06:13:31ID: 25365537

Did you check to see if you have any missing vb library references.  I would think you need to have a reference to MS Office Web Components (OWC)

If that is not the problem, try it using a set statement:
      Set objSOAPClient.MSSoapInit strSOAPServiceURL

also, did you try my suggestion.  What happened? :
         
   If proxyDetails.active Then
        objSOAPClient.ConnectorProperty("ProxyServer") = proxyDetails.proxy
   Else
        Set objSOAPClient = GET http://wpad/wpad.dat
   End If

 

by: puppydogbuddyPosted on 2009-09-18 at 06:24:19ID: 25365637

oops, typo i my pevious post:

change:
If that is not the problem, try it using a set statement:
      Set objSOAPClient.MSSoapInit strSOAPServiceURL

to this:
If that is not the problem, try it using a set statement:
      Set objSOAPClient.MSSoapInit = strSOAPServiceURL
     

 

by: puppydogbuddyPosted on 2009-09-18 at 07:36:50ID: 25366402

On a second thought, you can't use a set statement because the variable is declared as a string. ty it this way:
          objSOAPClient.MSSoapInit = strSOAPServiceURL

 

by: CyberUnDeadPosted on 2009-09-21 at 06:38:30ID: 25382684

puppydogbuddy:

Thank you for your patience and persistence.   Unfortunately the Set is not valid syntax.

This MSDN article http://msdn.microsoft.com/en-us/library/ms997641.aspx#xpsoap_mssoapinit illustrates the call to use the method on SOAP client:

Client.mssoapinit WSDLFile, Service, Port

I am using late binding to avoid referencing libraries directly in Microsoft Access.

    Dim objSOAPClient As Object
    Set objSOAPClient = CreateObject("MSSOAP.SoapClient30")

but I will look into adding the MS Office Web Components (OWC) reference.


 

by: puppydogbuddyPosted on 2009-09-21 at 07:06:44ID: 25382935

See this link and see if it helps:
                http://www.aspfree.com/c/a/VB.NET/Calling-a-Web-Service-using-VB6-with-SOAP-30/
Calling a Web Service using VB6 with SOAP 3.0
(Page 1 of 4 )

This article shows you how to create a client that calls a web service from Visual Basic 6 using SOAP 3.0. If you are still using VB 6.0 or C++ and don't plan to move into VB.NET, you will find this method very useful.

 

by: puppydogbuddyPosted on 2009-09-21 at 07:59:10ID: 25383577

some additional reference sources for SOAP and ms access:
                http://metrix.fcny.org/wiki/display/tips/How+to+Create+a+Microsoft+Access+Client+for+a+SOAP-based+Web+Service+API

http://jonathancamp.com/2005/06/28/web-services-soap-msxml-and-microsoft-access/

Have you seen this link?
          http://www.microsoft.com/downloads/details.aspx?FamilyId=C943C0DD-CEEC-4088-9753-86F052EC8450&displaylang=en
Note:
The Microsoft SOAP Toolkit is deprecated by the .NET Framework. SOAP Toolkit support will be retired in April 2005.







 

by: CyberUnDeadPosted on 2009-09-21 at 10:10:35ID: 25385125

puppydogbuddy:

    This is a legacy Microsoft Access application so VBA is my only option right now.  Here is an alternative SOAP framework that is still undergoing development - http://www.pocketsoap.com.

   Again thanks for all the assistance!

   I am going to reward your last two answers as the solution.   I am including below for completeness my working function, which I just tested on the machine that was failing and it now returns the correct information from the web service provider.

Public Function CallWebService(id As String) As String
    On Error GoTo Error_Handle
    
    Dim strSOAPResponse As String
    Dim lngResult As Long
 
    'Get Internet Explorer's Proxy Settings
    Dim proxyDetails As ProxyInfo
    proxyDetails = GetProxyInfoForUrl(WSDL_URL)
 
    'Requires Microsoft SOAP Toolkit 3
    'Late binding
    Dim objSOAPClient As Object
    Set objSOAPClient = CreateObject("MSSOAP.SoapClient30")
    
    'Early binding
    'Dim objSOAPClient As New SoapClient30
    
    lngResult = objSOAPClient.MSSoapInit(WSDL_URL, "CallWebService", "CallWebService.cfc")
    
    'Check if initalization failed
    If lngResult <> ERROR_SUCCESS Then
        MsgBox GetAPIErrorMessage(lngResult), vbExclamation
        GoTo Exit_Function
    End If
    
    'If proxy detected assign to SOAP Client
    If proxyDetails.active Then
        objSOAPClient.ConnectorProperty("ProxyServer") = proxyDetails.proxy
        objSOAPClient.ConnectorProperty("EnableAutoProxy") = True
    End If
    
    'Setup SOAP Client properties
    
    objSOAPClient.ClientProperty("ServerHTTPRequest") = True
    objSOAPClient.ConnectorProperty("RequestHTTPHeader") = "Accept-Encoding: gzip"
    objSOAPClient.ConnectorProperty("Timeout") = 45000    '45 seconds
 
    'Make SOAP Request
    strSOAPResponse = objSOAPClient.CallWebService(id)
 
    'If empty error occurred
    If IsNull(strSOAPResponse) Or strSOAPResponse = vbNullString Then
        CallWebService = "ERROR"
    Else
        CallWebService = strSOAPResponse
    End If
 
    Set objSOAPClient = Nothing
 
Exit_Function:
    Exit Function
 
Error_Handle:
    Debug.Print "An error occurred: (" & Err.Number & ") " & Err.Description & " @ " & Erl, vbExclamation
    Resume Exit_Function
End Function

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:

Select allOpen in new window

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...