Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve XML from web service with VBA

Status
Not open for further replies.

TKNIG01

Programmer
Jan 27, 2004
7
GB
Hi,

I am trying to retrieve XML from a web servcice using VBA (Web Services Toolkit 2.0) and am having success with one function but not another.

The data passed back from all functions is in the form of an XMLnodeList and for the simple ones I can use the following code:

Dim xml as New DOMDocument
Set TransData = DPX.wsm_GetPeople(str_ID, str_Password)
xml.LoadXml TransData(0).xml
xml.Save ("C:\People.xml")

to just pass the root node to a new xml document and then I can save. This works fine.

A different function returns a more complex dataset however and the root node is actually a schema for the data that (supposedly) follows.

The same code above returns a schema but no data even though the web service is definitely generating data because they send me one of my requests as an XML file. I'm a complete noob to XML so I hope it's something really small but i've been reading around the subject for quite a while and I still haven't got anywhere. The MS documentations falls just short of what I need and most other stuff is for .net or Java

Any help would be much appreciated.

Thanks,

Tom
 
If you're sure that it returns ixmldomnodelist, you can always save all the info within it by wrapping them in your root, say <env>...</env> (and even with your own namespace), like this.
[tt]
dim sxml as string
dim bret as boolean
sxml="<env>" & vbcrlf
for i=0 to TransData.length-1
sxml=sxml & TransData(i).xml & vbcrlf
next
sxml=sxml & "</env>"
bret=xml.LoadXml(sxml)
if bret then
xml.Save "C:\People.xml"
else
'notification of parsing error
end if
[/tt]
 
Thanks Tsuji,

Worked perfectly! Was actually worth going through all the hassle because I found out a lot of stuff that would have probably confused me later on but it's good to get it sorted all the same....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top