views:

171

answers:

2

I'm researching the viability of a planned project that is to consume some data from a web server.

Not being an access developer myself I wanted to know:

  1. Is it possible to consume xml from an access database?
  2. Can xml be consumed over an authenticated connection?
  3. Can xml be consumed over an encrypted connection (https)?
  4. What are the 'gotchas' of this process?
A: 

Access as of the 2003 version has full support of web services. There is a wizard that you can use to point at a web service definition and generate an access database and forms to access it.

Here is a tutorial for consuming web services

Mike Brown
That tutorial is seven years old. I notice that Access 2007 still has no web service support. I think I'd stay away.
John Saunders
John, the article is dated December 16, 2005 which is four years old. Could you be a bit more specifc as to your objections?
Tony Toews
@Tony, 4 years and 7 years are equivalent to him I guess. Either way, it's a moot point when the tutorial was written because it tells the OP how to do what he wants to do.
Mike Brown
I'm not sure about the wizard, though -- my copy of A2003 has no such wizard on the Tools menu. The article states that you have to install the MS Web Service toolkit, and *then* the wizard will be available in Access.
David-W-Fenton
@John Saunders: what's wrong with 4-year-old code if it still works? Is there some part of the tutorial that broke for you in A2007?
David-W-Fenton
@Mike Brown i'm not looking for a tutorial, nor do I want to create a database from a web service. I'm looking at the viability of augmenting existing data within an access database with that from a web server in a secure manner. Additionally this data will have to be cached, and the cache updated when the web service is accessed.
Josiah
@All: Sorry, I saw a seven-year-old article referred to by the posted link. I can't find it now. In any case, the SOAP Toolkit that all this is based on is extremely obsolete, and you should not depend on it.
John Saunders
+1  A: 

First of all, you can use the web services add in (soap tool kit). Dispite silly comments here, that web add-in for office received a update December 12, 2007

http://support.microsoft.com/kb/937961

However, really, for grabbing XML from a web site you can write just a few lines of code to do this in ms-access if you use the MS-XML library

  Public Sub GetQuote2()

     Dim objXML           As Object
     Dim strSymbol        As String
     Dim strURL           As String
     Dim strWFormat       As String

     Set objXML = CreateObject("MSXML2.XMLHTTP")

     strURL = "http://ca.finance.yahoo.com/d/quotes.csv?s="
     strWFormat = "&f=sl1d1t1c1ohgv&e=.csv"


     strSymbol = "MSFT"

     objXML.Open "GET", strURL & strSymbol & strWFormat, False
     objXML.Send

     Debug.Print "Symbol = " & Split(objXML.ResponseText, ",")(0)
     Debug.Print "Trade  = " & Split(objXML.ResponseText, ",")(1)
     Debug.Print "Date   = " & Split(objXML.ResponseText, ",")(2)

  End Sub

Output when above run:

Symbol = "MSFT"
Trade  = 24.62
Date   = "9/4/2009"

The above code example happens to "GET" a CSV file, but in most cases that web service will give you a xml file or even document. Using the MSXML library also means you have full xml parsing at your fingertips.

You can/could also write out the xml text string to a local file and use the XML import features we have in ms-access.

So access does have an xml import ability. With xml import support + the MSXML library this takes VERY FEW lines of code to grab xml from a web site. Access 2010 will have additional web services support.

For all intensive purposes, I really don’t recommend using the soap web tool kit (the 2003 add in code) for office since the above code is far more simple, and a LOT less hassle and code.

Albert D. Kallal
@Albert D Kallal thanks for your detailed response, definately the kind of thing that I was looking for. Can you do the same over an authenticated and encrypted connection, or do you need to invoke the full soap toolkit for that?
Josiah
MSXML supports authentication. The use of an encrypted connection such as SSL does not effect this issue. Using MSXML, or the soap tool kit would not change this issue of security. So, no, you don’t gain anything by attempting to use the soap tool kit in place of the XML library.
Albert D. Kallal