Jump to content
Sign in to follow this  
Clay

Trouble retrieving xml data

Recommended Posts

Clay

Hey guys,

Quick Question: Has anyone ever tried using autoit to retireve data using webservies?

I am attempting to do with now. I am trying to access a webservice in order to return some data and manipulate it. Now I have never tried using webservices before and I am faily new to autoit so I am getting confused on two fronts. I have included a snippet of my code below where I am attempting to access the webserive... the result that is returned is 0 or -1 depending which web service I include in the http: path.....could someone please take a look at the code and let me know:

1). if I am missing anything or doing anything wrong in order to access the webservice - is my syntax off? is the script not suffient in order to accomplish what

I want?

2) Why I am getting a result of 0 or -1?

Note: The web service I am attempting to access does not use SOAP. Also in the snippet below I just included the path to a Microsoft web service... I can not provide the one I am actually trying to access as it contains sensitive data - I hope this does not offend anyone.

Dim $objHTTP 
Dim $objReturn
Dim $value
Dim $packageQueryUrl= "http://www.microsoft.com/technet/scriptcenter/default.mspx"


$objHTTP = ObjCreate("Microsoft.XMLHTTP")
$objReturn = ObjCreate("Msxml2.DOMdocument.3.0")

$objHTTP.Open("Get", $packageQueryUrl, False )
$objHTTP.Send

$value = $objReturn.loadXML($objHTTP.ResponseText)
MsgBox(0,"DevCentral Result equals: ", $value)
Edited by Clay

Share this post


Link to post
Share on other sites
Clay

Ok....no one replied but thanks to all who atleast took a look. Fortunately I was able to solve my issue myself.... so I am just adding a reply to my initial post for the benefit of those who will run into this issue after me. I have included the code below that enabled me to retrieve information from the webservice.

1. Basically this was wrong. loadXML is not required

$value = $objReturn.loadXML($objHTTP.ResponseText)

2.An XMLHTTP Object is not required, but it doesn't hurt to keep it in.

Below you can find the corrected script

Dim $objHTTP 
Dim $objReturn
Dim $Result
Dim $packageQueryUrl= "http://www.microsoft.com/technet/scriptcenter/default.mspx"

$objHTTP = ObjCreate("Microsoft.XMLHTTP")
;$objReturn = ObjCreate("Msxml2.DOMdocument.3.0")

$objHTTP.Open("Get", $packageQueryUrl, False )
$objHTTP.Send

$Result = $objHTTP.ResponseText

MsgBox(0,"Result equals: ", $Result)

I hope this is helpful to someone in the future.

Peace !!!!!

Share this post


Link to post
Share on other sites
PsaltyDS

...I am just adding a reply to my initial post for the benefit of those who will run into this issue after me.

Thanks for posting your resolution.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
ptrex

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×