Link to home
Start Free TrialLog in
Avatar of Susan Stevenson
Susan StevensonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

MS Access VBA to import data from Webservice

Presently my webservice returns data in the browser like this "1 462539 100000 100036 requested SSVP  Vehicle Package ...."
Only when I view source do I get access to the underlying xml which I can import with no issues once saved locally.  

I am trying to automate the import from access, how do I do this?

Can I get Access to View source and save the xml file for me?
Avatar of ste5an
ste5an
Flag of Germany image

It depends on the kind of web service.

Yup, e.g. see this thread: Retrieving RSS Feed via XML url to Access table.
Avatar of Susan Stevenson

ASKER

thanks ste5an.. I'm having an issue accessing the source code from vba which is the main issue i think. in chrome, when i add "view-source" to the front of the url it brings me to the source xml directly. I tried sneaking this in front of my application. import xml url in vba but of course this is not leveraging off chrome so will not work. im wondering now if i can use vba to:

open chrome (but hide from the user)
navigate to the view source url (which also contains login and id parameters - i believe this too causes an issue)
save page as .xml file

from there, i could get everything else to work i think.

any help would be appreciated, thanks
oh i believe it is REST webservice
Have you took a look at the linked thread?

By using MSXML2 you can either query the web service and parse the XML on the fly. Or you use the XMLHTTP60 class to download it and save it.

For the rest: Try to rephrase your question. It's not clear to me, what your actual problem is.
my apologies! i did not see the database on the thread.. will look in more detail now. thank you
Hi Ste5an,

I have attached a copy of the data I see when I go to the web service via IE.  As you can see, it is not in a structured format.  I notice that the example in the previous threads directs you straight to structured xml data.

I am trying to download the source structured xml data which is only visible to me when I right click and  'View source' in the browser.... unless I use chrome which I can navigate directly to using the 'view-source' clause at the beginning of the url. Hence, I wanted to reproduce this behaviour using vba.

Forgive me if I am missing something obvious, I'm self taught with vba and certainly never even considered any kind of integration with web services before.
'
Thanks in advance..

Susan
web-services-response.png
Hi Ste5an,

I have also tried the URL from your example against my own import xml code.  It imports for the most part although there are some data truncations.

I believe the issue lies in me not getting direct access to the xml code :-(

Susan
For concrete help, I'd need the web service's URL, when possible. Otherwise it's hard to talk about unseen data.
ASKER CERTIFIED SOLUTION
Avatar of Susan Stevenson
Susan Stevenson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
resolved using alternative method